How to use the YAML Validator & Formatter
- Paste your YAML into the left box, or click Load sample.
- Read the result under the boxes: ✓ Valid YAML, or the error with its line and column.
- Click Go to line to jump to the problem, fix it, and the check runs again as you type.
- Copy the formatted YAML on the right if you want consistent indentation.
YAML vs JSON
| YAML | JSON | |
|---|---|---|
| Structure | Indentation (spaces only, never tabs) | Braces {} and brackets [] |
| Comments | Yes, with # | No |
| Quotes | Usually optional | Required around keys and strings |
| Multiple documents | Yes, separated by --- | One value per file |
| Used for | Config: Docker Compose, Kubernetes, GitHub Actions, Ansible | APIs, data exchange, package.json |
Every JSON document is also valid YAML 1.2, so YAML parsers can read JSON directly. Going the other way loses comments, because JSON has no place for them.
Common YAML gotchas
- Tabs: YAML doesn't allow tab characters for indentation. Use spaces.
- Unquoted surprises:
on,yesandnoare plain strings in YAML 1.2 (which this tool follows), but older YAML 1.1 parsers read them as true or false. Quote them to be safe, like"yes". - Colons in values: a value like
time: 12:30or a URL with:may need quotes. - Leading zeros:
zip: 01234may be read as a number. Quote codes, IDs and version numbers like"3.10".
What the validator checks
It checks that the file is well-formed YAML 1.2: indentation, quotes, brackets, duplicate keys and multiple documents. It doesn't know the rules of a particular tool, so a file can be valid YAML and still have a setting Docker or Kubernetes doesn't recognise.
Frequently asked questions
Does it catch duplicate keys?
Yes. A mapping with the same key twice is reported as an error, with its line.
Why does the formatted output lose my comments?
The formatted copy is rebuilt from the parsed data, which has no comments. Your original text is untouched.
Is my file uploaded?
No. Validation runs in your browser.