YAML Formatter

Normalise indentation, spacing and quoting across a YAML file while keeping your comments.

Input · drop a file

Output

What the formatter normalises

  • Indentation to 2 or 4 spaces at every level.
  • Extra spaces after colons and inside flow collections.
  • Unnecessary quotes around plain strings.

Comments and document separators (---) are preserved. The file is parsed first, so an invalid file is reported with its line instead of being reformatted wrongly.

Questions

Will it reorder my keys?

No. Key order and comments stay as written.

Can it convert flow style [a, b] to block style lists?

It keeps the style you used. Convert through JSON to YAML if you want everything in block style.

Related tools