YAML Validator Guide: Indentation, Keys and Lists
Learn the structural rules that catch most YAML mistakes before they reach an application.
What is the YAML Validator & Formatter?
This tool is not a full YAML parser. It checks the common subset: indentation must use spaces in consistent steps, each mapping line must look like key: value or key:, list items must start with a dash, and the same key must not repeat at the same level. Tabs are rejected, because YAML forbids them. It then re-indents lines to two spaces per nesting level, based on their relative depth. Anchors, multi-line blocks, flow collections and other advanced YAML features are outside this subset and may be flagged even though a full parser would accept them.
How to use it
- Paste your YAML into the box.
- Click Validate & Format YAML.
- Fix any listed problems, or copy the normalised version.
Worked example
For the sample, the tool reports the YAML as valid under the subset check and reproduces it normalised with 2-space indentation for the nested address fields.
Why do duplicate keys matter?
Because a parser usually keeps only one value for a repeated key, silently dropping the other. Flagging duplicates stops that silent loss.
Frequently asked questions
Is this a full YAML parser?
No. It covers the common subset of nested maps, lists and scalars, and advanced features may be flagged even if a full parser accepts them.
Why are tabs rejected?
Because YAML itself forbids tab indentation. A file with tabs will fail in most YAML tools, so flagging them early saves confusion.