YAML Validator & Formatter
Validate YAML online and list every error and warning with line and column: duplicate keys, tab indentation, bad indentation, unresolved aliases. Then reformat.
How to use YAML Validator
- 1Paste YAML into the input box, or open a .yaml or .yml file.
- 2Read the status line and the list of errors and warnings, each with a line and column.
- 3When it is valid, pick an indent and copy or download the re-formatted YAML, or switch Mode to Minify, Tree or a JSON conversion.
What makes it better
- Lists all errors and warnings together, sorted by position
- Catches duplicate keys, tab indentation, bad indentation and unresolved aliases
- Shows document count and top-level keys for valid files
- Re-formats with 2 or 4 space indentation and keeps comments; Minify, Tree and JSON conversion are one click away
- Multi-document files (---) are checked document by document
About YAML Validator
YAML Validator checks a YAML file against YAML 1.2 and lists every problem it finds, not just the first one, each with a line and column. When the file is valid it shows how many documents it holds and which top-level keys they define, and it can rewrite the file with consistent indentation while keeping your comments. The Mode switch also minifies the file, shows it as a tree or converts it to and from JSON, and everything is processed in your browser.
Common uses
- Check a Kubernetes manifest, Helm values file or GitHub Actions workflow before committing it.
- Find the stray tab or the mis-indented line that breaks a Docker Compose file.
- Catch duplicate keys that would silently override an earlier setting.
- Normalise a file written by several people to one indentation style.
Example
Input
# deploy settings
app:
name: shop
tags: [web, api]
env:
- KEY=value # inline note
- DEBUG=false
Result
# deploy settings
app:
name: shop
tags: [ web, api ]
env:
- KEY=value # inline note
- DEBUG=false
Good to know
- This checks YAML syntax, not meaning. A file can be valid YAML and still be wrong for Kubernetes, Compose or any other tool that expects specific keys.
- Reformatting keeps comments, anchors and aliases, but it can change quoting style, remove extra spaces before comments and collapse blank lines. Review the result with a diff if exact layout matters. Minify mode removes comments entirely and writes each document as one flow-style line.
- Custom tags such as !Ref are shown as warnings, because they may be valid for the tool that reads the file even though plain YAML cannot interpret them.
YAML Validator FAQ
How do I check whether my YAML is valid?
Paste it into the box. The status line says Valid YAML with a summary, or lists each problem with its line and column. Fix the first entry and the list updates immediately, so you can work down it. The Format mode re-indents a valid file and Minify collapses each document to one line.
Why does YAML not allow tabs for indentation?
The YAML specification only allows spaces to indent, because tabs display at different widths in different editors and would make nesting ambiguous. Replace each leading tab with spaces and the error disappears.
What does a duplicate key error mean?
The same key appears twice in one mapping. Many parsers keep only the last value without warning, so an earlier setting is lost silently. The validator reports the repeated key and the line where it is repeated.
Does reformatting remove my comments?
No. Comments are kept and stay next to the content they were attached to. Spacing around them is normalised, a comment inside a flow list such as [a, b] may move, and blank lines can be collapsed.
Can it validate a file against a schema?
Not here. This page checks YAML syntax only. To check structure against a schema, convert the file to JSON with the YAML to JSON page and use the JSON Schema Validator.