YAML Validator & Formatter checks a YAML file as you type, points at the exact line of any problem and explains it in plain language, then re-indents the file consistently. Your comments and the order of your list items are kept, so it is safe to run on Kubernetes manifests, CI workflows and docker-compose files. Everything happens in your browser.
How to check and tidy YAML
- Paste your YAML into the left box, or open a
.yamlor.ymlfile. - Problems appear straight away with their line number. Click Show to jump to one.
- Once it is valid, the tidied version appears on the right. Choose 2 or 4 spaces, and optionally sort keys.
- Click Copy or Download.
The errors this catches
- Tabs used for indentation. YAML forbids them outright; only spaces work.
- Inconsistent indentation, where items meant to be siblings do not line up.
- Duplicate keys. Many parsers silently keep the last one, so a setting you changed is quietly ignored. Here it is an error.
- A missing colon, or a value containing
:or#that needs quotes. - Unclosed brackets and quotes in inline lists and strings.
Values that are not what they look like
YAML converts some bare words automatically, which causes real bugs. In older YAML 1.1 tools, no,off and n become false, and yes and on becometrue, so a country code like NO turns into a boolean. Version numbers such as1.10 can lose their trailing zero, and a value like 12:30 may be read as a number. This checker follows the newer YAML 1.2 rules, where those stay as text. If the tool that will read your file still uses YAML 1.1, put quotes around such values.
Why not convert to JSON and back?
That is a common way to tidy YAML, but it discards every comment and can reorder keys. Configuration files are usually full of comments explaining why a value is what it is, so this tool reformats the document in place instead. If you do want the data as JSON, use YAML to JSON, andJSON to YAML for the other direction.
Sorting keys
Sorting keys alphabetically at every level makes two versions of a file easy to compare, which helps when reviewing changes to a long configuration. Leave it off when order carries meaning to a reader, such as the steps of a workflow. List items are never reordered, because their order almost always matters.
Frequently asked questions
Why does YAML break so easily?
YAML uses indentation to mean structure, so a single misplaced space changes what a file means, and a tab breaks it entirely. Most errors come down to indentation, a missing colon, or a value that needs quotes.
Are my comments kept when it reformats?
Yes. Comments, including ones at the end of a line, are preserved, and so is the order of your list items. That is the main reason to tidy YAML here rather than converting it to JSON and back, which throws comments away.
What does "duplicate key" mean?
The same key appears twice in one block. YAML quietly keeps only the last one, so a setting you think you changed may be silently ignored. This tool reports it as an error rather than letting it pass.
Why should I be careful with values like "no", "on" and "1.10"?
In older YAML 1.1 tools, no and on become false and true, and version numbers like 1.10 can turn into 1.1. This checker follows YAML 1.2, where they stay text, but if your tool uses 1.1, wrap such values in quotes to be safe.
Is my file uploaded?
No. The YAML is checked and reformatted in your browser, so configuration files with hostnames, keys or internal names never leave your device.
Last updated