The result shows here.
How to use
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.
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.
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
- Highlights the error line and explains common YAML mistakes in plain words.
- Style warnings catch the Norway problem, octal-looking numbers, base-60 times and mixed indentation.
- Re-prints valid YAML with consistent indentation, or shows it as JSON.
- Handles multi-document files and runs in your browser.
The most common YAML errors
These errors cover most broken YAML files. The message in the result names each one.
| Error | Example | Fix |
|---|---|---|
| Tab indentation | A line starting with a tab | Use spaces only |
| Bad indentation of a mapping entry | A key with one space too many | Line it up with its siblings |
| Duplicate key | image: twice under one service | Remove or rename one of them |
| Missing colon or space | image:nginx | Write image: nginx with a space after the colon |
| Unclosed quote | name: "web | Close the quote |
| Alias before anchor | <<: *defaults before &defaults | Define 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.