YAML Formatter
Normalise a YAML file's indentation and confirm it parses. Because the tool round-trips through a parsed structure, the output shows you what your YAML means, not just how it looks — which is how you catch a value being read as the wrong type.
Normalise YAML parses your file and writes it back with consistent two-space indentation and quoting. Show as JSON reveals exactly how each value was typed, which is how you catch a value being read as the wrong type. Comments do not survive a round trip.
How it works
Formatting YAML means parsing it
Unlike reformatting JSON, you cannot tidy YAML safely with text substitution — indentation is the structure. This tool parses the document into a data structure and serialises it back out, which normalises indentation and quoting, and proves the file parses at all.
The round trip discards comments, because comments are not part of the parsed data. If you need comments preserved, format by hand or use a comment-preserving library such as ruamel.yaml.
Reading the output to catch type bugs
Switch to Show as JSON and you see each value's actual type: a quoted string stays a string, an unquoted no becomes false, an unquoted 1.10 becomes 1.1. This is the fastest way to find out why a config value isn't behaving — the file looks right, but the parser disagrees.
Indentation and tabs
Tabs are not legal YAML indentation. Two spaces per level is the convention. Sequence items may be indented at the same level as their parent key or one level deeper; both are valid, and this tool outputs the common form. Keys must be unique within a mapping — a duplicate key silently overwrites in most parsers.
What people use it for
- Confirming a CI or Kubernetes file parses before committing it.
- Finding out why a config value is wrong when the file looks correct.
- Normalising indentation in a file several people have edited.
- Checking for a duplicate key that is silently overwriting an earlier one.
- Flattening a hand-written file into a canonical form before diffing it.
Nothing is uploaded. This tool runs entirely in JavaScript in your browser. Your input is never sent to a server, never logged and never stored, and no account is required. Once the page has loaded you can go offline and it still works — open your browser's network tab and watch if you'd like to confirm it.
Frequently asked questions
Why were my comments removed?
Formatting works by parsing the YAML and writing it back out, and comments are not part of the parsed data. If comments must survive, format by hand or use a comment-preserving library such as ruamel.yaml.
Why is my value a boolean when I wanted a string?
YAML infers types from unquoted scalars, and several words including yes, no, on and off are read as booleans by many parsers. Quote the value. Use Show as JSON to see exactly what each value became.
Does it support anchors, aliases and multi-document files?
No. Anchors, aliases, merge keys, multi-document streams and block scalars are outside the subset this tool handles. It covers ordinary config files: maps, sequences, nesting, inline flow style and typed scalars.
Can I use tabs?
Not in valid YAML. This tool converts tabs to spaces before parsing so you can still read the file, but strict parsers reject tab indentation and you should fix the source.
Is my file uploaded?
No. This tool runs entirely in your browser. Nothing is uploaded, which matters when the thing you are formatting is a production config or a payload with real data in it.
Tools that run where your code is
This page does its work in your browser because sending your data to a server to process it is a bad default. Catalase applies the same idea to AI coding: a free, open-source code editor that runs language models on your own machine through Ollama, with no account and no telemetry. Cloud models are there when you choose one, not by default.
Related tools
- YAML to JSON — Convert in both directions.
- JSON to CSV — Flatten JSON into spreadsheet rows.
- XML formatter — Indent and check XML.