YAML Validator

Paste your YAML and get instant validation with precise error locations — line number, column, and a context snippet showing exactly where the problem is. Everything runs in your browser — nothing is sent to any server.

Paste your YAML to validate
YAML Input

Related Tools

Frequently Asked Questions

What is the difference between a YAML syntax error and a semantic error?

A syntax error means the YAML is structurally invalid — wrong indentation, missing colons, unterminated strings, or illegal characters. The parser will reject it and report a line/column. A semantic error means the YAML is syntactically valid (it parses without error) but the resulting data is not what you intended — for example, an unquoted value like 'on' being parsed as boolean true instead of the string 'on'. This validator catches syntax errors. Semantic errors require knowing the expected schema.

Why does YAML use indentation for structure instead of brackets?

YAML was designed for human readability. The spec authors chose indentation (like Python) to avoid the visual clutter of JSON's braces and quotes. The tradeoff is that indentation is invisible whitespace — a single wrong space or tab creates a parse error. YAML also requires consistent indentation within each block, but the number of spaces (2, 4, etc.) is flexible as long as it's consistent at each level.

Why does YAML parse 'on', 'yes', 'true', 'no', 'false', 'off' as booleans?

YAML 1.1 (used by many libraries including js-yaml by default) defines an extended set of boolean literals: true/false, yes/no, on/off — all case-insensitive. This causes the 'Norway problem': the country code 'NO' in a YAML file becomes boolean false. To safely use these as strings, quote them: 'on', 'yes', 'no', 'off'. YAML 1.2 reduced booleans to only true and false, but library support varies.

What does the error 'bad indentation of a mapping entry' mean?

This error means a key-value pair inside a mapping (object) is not aligned consistently with other entries at the same level. YAML requires all keys in the same mapping to share the same indentation column. The most common cause is accidentally mixing tabs and spaces — YAML does not allow tabs for indentation, only spaces. Check your editor's settings to ensure it inserts spaces, not tabs, when you press Tab.

Can this validator check multi-document YAML files (separated by ---)?

The validator processes a single YAML document. If your file contains multiple documents separated by ---, js-yaml.load() will read only the first document and ignore the rest without error. Use yaml.loadAll() programmatically to process all documents. If the separator causes a parse error in your input, that's a sign your documents have structural issues.