YAML Formatter & Beautifier
This YAML formatter normalises indentation, quoting and flow style in a single pass, so a file assembled by several people reads as though one person wrote it. Inline collections are expanded to block style, which is what most YAML style guides ask for, and quoting is applied consistently rather than wherever the original author happened to add it. Keys can optionally be sorted to produce a canonical form that diffs cleanly. Because formatting reads the document into values and writes it back, comments are not carried across — they are not part of the parsed data.
How it works
Normalises indentation, quoting and flow style in one pass, so a file assembled by several people reads as though one person wrote it. Inline collections are expanded to block style, which is what most YAML style guides ask for.
Formatting reads the document into values and writes it back out, which means comments are not carried across — they are not part of the parsed data. Keep a copy if your comments matter.
Everything runs in your browser — nothing you paste is sent to a server.
How to format YAML online
- Paste your YAML into the input on the left.
- The normalised document appears on the right with consistent indentation.
- Optionally sort keys, or quote every string, then copy or download.
What formatting changes
Indentation is made uniform, inline collections such as [8080, 9090] are expanded to block style, and
quoting is applied consistently rather than wherever the original author happened to add it. The result is a file
that reads as though one person wrote it, which is what makes later diffs readable.
Comments are not carried over
Formatting reads the document into values and writes it back out. Comments are not part of the parsed data, so they do not survive the round trip. This is a real trade-off rather than an oversight — keep your original if the comments matter, and use this on generated or machine-written YAML where they usually do not.
Common use cases
- Cleaning up a manifest or pipeline file assembled by several people.
- Producing a canonical form so two config files diff cleanly.
- Fixing indentation that drifted after a copy and paste.
Frequently asked questions
How do I format YAML online?
Paste your YAML into the left panel and the normalised document appears on the right with consistent indentation. Optionally sort the keys or quote every string, then copy or download.
Are my comments preserved?
No. Formatting reads the document into values and writes it back out, and comments are not part of the parsed data, so they do not survive. Keep your original if the comments matter.
What exactly does formatting change?
Indentation is made uniform, inline collections such as [8080, 9090] are expanded to block style, and quoting is applied consistently instead of appearing wherever the original author added it.
Why would I sort the keys?
Sorting gives you a canonical form, so two files holding the same settings stop producing noisy diffs just because their keys were written in a different order.
Is my YAML uploaded anywhere?
No. Formatting runs entirely in your browser.
Related tools
YAML Validator
This YAML validator parses your document and reports the first error with its line and column.
YAML Viewer
This YAML viewer renders a document as a collapsible tree so the nesting becomes obvious.
YAML to JSON Converter
This YAML to JSON converter parses YAML into JSON online, supporting anchors, aliases, and multi-document files.