My Tool Studio
Developer

YAML Validator

This YAML validator checks YAML as you type and highlights the exact line of any syntax error, with the column and a plain-English reason such as tabs used for indentation, a key that does not line up or a duplicate key. Valid files also get style warnings for things that parse but often cause bugs, like yes and no values that older tools read as booleans, leading zeros and mixed indentation. Choose the schema, allow duplicate keys if you need to, and see the result re-printed as clean YAML with 2 or 4 spaces or as JSON. Multi-document files separated by --- are supported. Paste, drop, upload or load YAML from a URL. It runs in your browser.

Always freeNo sign upRuns in your browser

The result shows here.

How to use

01

Add your YAML

Paste YAML into the editor, drop or upload a .yaml or .yml file, or press Load URL. Try sample loads a docker-compose file with a bad indent and a no value.

02

Read the result

Errors highlight the line and show the column, a reason and nearby lines; press Go to error to jump there. Valid YAML shows the number of documents and any style warnings, each linked to its line.

03

Format or convert

Use the Formatted YAML tab to re-print the file with 2 or 4 spaces, sorted keys or indented lists, or the As JSON tab to see the data as JSON. Copy or download either one.

Why YAML Validator

The most common YAML errors

These errors cover most broken YAML files. The message in the result names each one.

ErrorExampleFix
Tab indentationA line starting with a tabUse spaces only
Bad indentation of a mapping entryA key with one space too manyLine it up with its siblings
Duplicate keyimage: twice under one serviceRemove or rename one of them
Missing colon or spaceimage:nginxWrite image: nginx with a space after the colon
Unclosed quotename: "webClose the quote
Alias before anchor<<: *defaults before &defaultsDefine the anchor first

Style warnings that are legal YAML

These lines parse without errors, but different tools can read them differently. The validator lists them so you can decide.

  • yes, no, on and off: text in YAML 1.2, booleans in YAML 1.1. Use true and false, or quote the value.
  • Numbers with a leading zero, such as 0123: some tools read them as octal. Quote zip codes and IDs.
  • Times such as 22:22: YAML 1.1 can read them as base-60 numbers. Quote port mappings like "8080:80".
  • Mixed indentation, such as 2 spaces in one block and 3 in another: legal, but easy to break when editing.
  • Trailing spaces at the end of lines: harmless, but noisy in diffs.

Common questions

How do I check if my YAML is valid?
Paste it into the editor and read the result on the right. Valid YAML shows a green Valid YAML box with the number of documents. Invalid YAML highlights the line with the problem and explains it, and nothing needs to be pressed.
Why does the YAML validator say bad indentation of a mapping entry?
A key does not line up with the keys around it, often because of one extra or missing space, or a missing colon on the line above. In the sample, restart has five spaces while its siblings have four. Line keys up with their siblings, using spaces only.
Can YAML use tabs for indentation?
No. The YAML specification allows only spaces for indentation, so a tab at the start of a line is an error. Replace each tab with spaces, usually two per level.
What is the Norway problem in YAML?
YAML 1.1 tools read unquoted yes, no, on and off as booleans, so a country code NO turned into false. YAML 1.2, which this validator uses, keeps them as text, but tools such as older PyYAML versions still convert them. The style warning flags these values; quote them or use true and false.
Does the YAML validator support multiple documents?
Yes. Documents separated by --- are each parsed and checked. The result shows how many were found, and the Formatted YAML and As JSON tabs include all of them.
Does formatting YAML here keep my comments?
No. The Formatted YAML tab re-prints the parsed data, so comments are dropped and anchors are expanded into full copies. Use it to check structure or tidy generated files, and keep your commented original as the source.
Does the YAML validator check Kubernetes or Docker Compose fields?
No. It checks YAML syntax and common style problems, not whether apiVersion, services or other fields are valid for a particular tool. Use kubectl apply --dry-run=client or docker compose config for that.
Why does the YAML validator reject duplicate keys?
A key repeated in the same mapping is almost always a mistake, and different tools keep different copies of it. The validator reports it as an error by default. Tick Allow duplicate keys if you only want the last value to win.
Is my YAML uploaded to a server for validation?
No. Parsing and checks run in your browser tab. Only Load URL involves the site's server, which fetches the public address you give it because browsers block most cross-site reads.

More Developer tools

View all