About this YAML formatter
YAML is the configuration language of Kubernetes, Docker Compose, GitHub Actions, Ansible, and many apps, and a single misplaced space can break a deployment. This validator reads your YAML the way those tools do and points to the line of the first problem: a tab, a key that does not line up, a missing colon, a duplicate key, an unclosed quote or bracket, or an alias without an anchor. It can then rewrite the file with consistent indentation, compact it into one-line flow style, or convert it to JSON, with anchors and << merge keys already expanded.
How to validate and format YAML
- Paste your YAML. Paste a config file or press an example. An example only fills the box.
- Choose an action. Format & beautify, Compact, Validate only, or Convert to JSON. Pick the indent and whether to sort keys.
- Press Format YAML. The result appears below, or the line number and a short explanation of the first error.
- Copy or download. Press Copy result or Download.
Frequently asked questions
Are comments kept when I format?
No. Formatting rebuilds the YAML from its data, so comments are dropped and anchors and aliases are written out in full. Use Validate only to check a file without changing it.
Why are tabs an error?
The YAML specification only allows spaces for indentation, because tab widths differ between editors. Replace tabs with two or four spaces.
Is "yes" read as true?
No. This validator follows YAML 1.2, where only true and false are booleans; yes, no, on, and off stay text. Some older tools (YAML 1.1) treat them as booleans, so quote them if a value must stay text everywhere.
What do anchors, aliases, and << do?
An anchor such as &defaults names a value, an alias such as *defaults reuses it, and <<: *defaults copies its keys into the current mapping. Keys written directly in the mapping win over merged ones.
Can I validate a file with several documents?
Yes. Documents separated by --- are checked one after another, and Convert to JSON returns them as a JSON array.