YAML Formatter & Validator
Free online YAML Formatter & Validator. No sign-up needed, and it runs in your browser.
Check YAML for errors (with the line and column) and tidy it: consistent indents, optional sorted keys — for Kubernetes, Docker Compose and CI files.
About YAML Formatter & Validator
Paste a Kubernetes manifest, Docker Compose file or CI workflow and you'll see at once whether it's valid YAML, with the line and column of the first problem. Valid files are rewritten with even indentation, and you can sort keys, choose single or double quotes, quote every string or wrap long text. Files with several documents are handled one by one, and duplicate keys and tabs used for indentation are reported as errors.
How to use YAML Formatter & Validator
- Paste your YAML into the Your YAML box; it's checked and formatted as you type.
- If there's a YAML error, read the line and column shown, fix that spot, and the output updates.
- Choose the Indent, Wrap long text and Quotes, and tick Sort keys A–Z, Quote every string or Keep anchors and aliases if needed.
- Click Copy or Download to take the Formatted YAML, or Show as JSON to see the same data as JSON.
How your data is handled
Your YAML is checked and formatted in your browser with the js-yaml library, loaded from our own site the first time. Nothing you paste, including passwords or keys in config files, is uploaded or stored.
Limits and accuracy
- Comments are removed, and inline lists and maps written like [a, b] are rewritten as indented blocks.
- Anchor names become ref_0, ref_1 and so on, and merge keys (<<) come out quoted, so other tools may stop merging them.
- It reads YAML 1.2, so 0755 becomes 755 and a version like 1.10 becomes 1.1; quote such values first.
- Custom tags, such as the Ref and GetAtt short forms in CloudFormation templates, aren't supported and show an error.
Questions and answers
Why are my comments gone?
The YAML is read into data and written out again, and comments aren't part of the data; the YAML specification calls them a presentation detail. Keep your original file if its comments matter, and copy them back where needed.
Does it check Kubernetes or Docker Compose rules?
No. It checks YAML syntax, such as indentation, tabs, unclosed quotes and duplicate keys, but not whether the fields and values suit Kubernetes, Compose or your CI system. Use those tools' own checks as well.
Can it handle a file with several documents?
Yes. Documents separated by --- are checked and formatted one by one, then joined again with --- between them. The count above the output shows how many documents, keys and items were found.