Home / YAML tools / YAML validator

YAML Validator

Check your YAML for syntax errors. Each error is shown with its line and column and a code excerpt, and you get warnings about values that are easy to misread.

Options

Result

How the validator works

The validator reads your YAML with a full YAML 1.2 parser and reports everything that is wrong, with the line and the column. It shows the lines around each error and a caret under the place where the parser got stuck. Because one mistake can confuse the parser for the lines after it, fix the first error and check again.

The most common errors

ErrorCauseFix
Tabs in indentationA tab character was used to indent a lineUse spaces. Set your editor to insert spaces for the Tab key.
Bad indentation of a mapping entryA key is indented by a different amount than its neighborsAlign the keys at the same level with the same number of spaces.
Nested mappings are not allowed in compact mappingsSomething like a: b: c on one linePut the inner key on its own indented line.
Map keys must be uniqueThe same key appears twice in one mappingRemove or rename one of them.
Missing closing quote or bracketA string, list or mapping was opened and not closedAdd the closing " or ] or }.
A colon in a plain valueA value such as time: 12:30 or a: b: cPut the value in quotes.
Unresolved aliasAn alias *name has no anchor &name before itDefine the anchor first, or fix the name.

Warnings and notes

A file can be valid and still not mean what you think. After the errors, the validator lists notes about values that different tools read in different ways:

  • yes, no, on, off, y and n. They are text in YAML 1.2 but booleans for parsers that follow YAML 1.1, which is the case for many older tools. The country code NO becoming false is the best known example.
  • Leading zeros such as 0755. YAML 1.2 reads this as the decimal number 755, but YAML 1.1 reads it as an octal number.
  • Trailing zeros in a version such as 1.10, which is read as the number 1.1.
  • Very large numbers that some tools cannot store exactly.
  • Trailing spaces at the end of lines.

Options

  • YAML version: 1.2 is the current standard. Choose 1.1 to see how an older parser would read the file, for example with yes and no as booleans.
  • Allow duplicate keys: by default a repeated key is an error, because most tools keep only one of the values and silently lose the other.

What it does not check

The validator checks YAML syntax only. It does not know whether your file is a valid Kubernetes manifest, a Docker Compose file or a GitHub Actions workflow. For that you need the schema of the tool that reads the file. Your YAML is processed in your browser and never uploaded.

Once your file is valid, tidy it with the YAML formatter, or convert it with YAML to JSON. The YAML syntax guide explains the rules.

Frequently asked questions

How do I check if my YAML is valid?

Paste it into the box. The validator tells you at once if it is valid, and lists every error with its line and column.

Why does it say that tabs are not allowed?

The YAML specification forbids tabs in indentation. Replace them with spaces.

Why are duplicate keys an error?

Most parsers keep only one of the values and silently drop the rest, so a repeated key is almost always a mistake.

Does it check Kubernetes or Docker Compose files?

It checks that the YAML is well formed. It does not check the fields that those tools expect.