YAML Formatter and Validator - Fix Indentation, Find the Error
YAML formatter and validator
What this tool does
YAML has no braces: the indentation is the structure. That makes it pleasant to read and easy to break — one stray space and a key lands under the wrong parent. This tool reindents a document to a consistent width, tells you where it is broken, and shows you how it is actually being read.
How to use it
- 1 Paste your YAML into the box and pick an indent width — two spaces is the common choice.
- 2 Press Format to reindent, or Validate to check it without changing a character.
- 3 Not sure a value is being read the way you meant? Press To JSON and look at it.
Tabs are not indentation
The YAML spec forbids tab characters in indentation, and most parsers refuse the file outright. The error they print is rarely helpful, because the line they blame is often the one after the real problem. This tool names the line with the tab on it.
Your comments survive
Many formatters parse a document into a tree and print it again. That is tidy, and it deletes every comment you wrote — which is unusable for a docker-compose or a CI pipeline. This one only rewrites the leading whitespace, so comments, key order and quoting style stay exactly as you left them.
Why NO became false
In YAML 1.1, the bare words yes, no, on and off were booleans. A country list with the code NO for Norway therefore loaded as false — a bug famous enough to have a name. YAML 1.2 dropped that rule, and this tool follows 1.2: only true, false and null are keywords. If you want a boolean, write true or false; if you want the text, you already have it.
Anchors, aliases and block scalars
An anchor (&name) marks a node so an alias (*name) can reuse it later — handy for repeated service definitions. Block scalars (| and >) carry multi-line text: the pipe keeps your line breaks, the angle bracket folds them into spaces. All three are understood here, and the indentation inside a block scalar is treated as data, not as formatting.