YAML Formatter
Re-prints a YAML document with consistent indentation and quoting, and is honest that comments do not survive the trip.
Loading the tool…
How to use this tool
- Paste the YAML you want re-indented.
- Choose two or four spaces, and whether the output should start with a --- marker.
- Select Format. Keep the original if its comments matter, because the formatted copy will not have them.
- Copy the result, or download it as a file.
What yaml formatter does
Formatting YAML means reading the document into values and writing those values back out. That fixes mixed indentation, inconsistent quoting and the ragged spacing that appears when three people have edited the same file, and it is the quickest way to see what a confusing document actually says once the layout stops arguing with the structure.
It also loses your comments, and there is no way around that. A YAML comment is attached to nothing — it sits between tokens and belongs to no key — so once the document has been read into values there is nowhere to put a comment back. Keep the original if the comments matter, and use this to understand a file or to normalise one that was generated rather than written.