About YAML Formatter
YAML is whitespace-sensitive in a way JSON and XML are not — two spaces where a sibling has four, or a stray tab, changes what the document means rather than merely how it looks. That makes hand-edited YAML a common source of subtle bugs, particularly in files several people edit over time: a docker-compose.yml, a GitHub Actions workflow, a Kubernetes manifest.
Formatting parses the document and writes it back out with consistent indentation throughout, which both fixes inconsistency and doubles as a validity check — a document that formats successfully is a document that parses. Compacting goes further, collapsing everything to YAML's inline flow style, which is the {a: 1, b: [2, 3]} form useful for a one-line environment variable or a compact diff.
The trade-off worth knowing: formatting is a parse followed by a fresh dump, so comments do not survive it. There is nowhere in YAML's data model — the parsed maps, sequences and scalars — to keep a comment attached to, which is true of every formatter built this way, not a limitation specific to this one.
How to format YAML
Paste your YAML
A config file, a Kubernetes manifest, anything.
Choose an operation
Format to re-indent, compact for flow style, or validate to check it.
Set the indent
Two or four spaces — tabs are not valid in YAML.
Copy or download
Take the result to your clipboard or save it as a .yaml file.
Common YAML mistakes
- Tabs for indentation — the specification forbids them outright; use spaces only.
- Inconsistent indentation between sibling keys, which is a parse error, not a style choice.
- An unquoted string that looks like another type — yes, no, on, off and null are all interpreted as booleans or null unless quoted.
- A colon inside an unquoted value, which YAML reads as starting a new key.