Developer tool

YAML formatter

Paste YAML. Get it back clean, or get told exactly which line is wrong.

YAML formatter Runs on your device
  • Runs in your browser — your text is never sent anywhere
  • No sign-up, no quotas, free to use as often as you like

How it works

YAML's whole design rests on indentation, which makes it pleasant to read and unusually easy to break. A single stray space produces an error message from a CI pipeline twenty minutes later. This parses it here and tells you immediately.

Validation with a line number

If the document does not parse, you get the line and column where it failed and the parser's own reason. That is almost always more useful than the formatted output, and it is the reason most people open a tool like this.

Reformatting

Valid YAML is parsed into a data structure and written out again from scratch, so the indentation becomes uniform, quoting is normalised and stray trailing whitespace disappears. Because it round-trips through data rather than editing text, the result is guaranteed to be valid.

What round-tripping costs you

Comments are lost. They are not part of the data, so a parser discards them. Anchors and aliases are expanded into their full values rather than preserved. If your file's comments matter, format a copy and apply the indentation fixes by hand.

Sorting keys

Alphabetical ordering makes two configuration files genuinely comparable in a diff. It is also the wrong choice for a file where order carries meaning for a human reader — a CI pipeline reads better in execution order than alphabetically.

Multiple documents

A file containing several documents separated by --- is handled, and each is formatted in turn.

FAQ

YAML formatter — questions

Why did my comments disappear?

Formatting parses the YAML into data and writes it out again, and comments are not part of the data. Format a copy if you need to keep them.

Does it tell me where the error is?

Yes, with the line and column and the parser's own explanation.

Is my YAML uploaded?

No. It is parsed in your browser, which matters given how often YAML holds secrets and infrastructure detail.

Can it handle multiple documents in one file?

Yes, documents separated by --- are each formatted.

Should I sort the keys?

Useful for comparing two config files. Unhelpful when the order is meaningful to a reader.