Tidy up YAML: consistent indentation and spacing, and your comments stay.
Loading the tool...
How to use YAML Formatter
Paste YAML. The formatter engine loads in a moment the first time.
Choose the indent.
Copy the result.
About YAML Formatter
A formatter for YAML has to be careful. Comments are important in YAML files, and many conversion tools throw them away. This one keeps them. It only changes whitespace, indentation of nested blocks and the spacing around list markers.
It uses the same formatting engine as the popular Prettier code formatter, which loads on demand the first time you use it. After that, formatting is instant.
Frequently asked questions
Are my comments kept?
Yes. Unlike conversion tools that parse YAML into data and write it back, this formatter works on the text and leaves comments where they are.
Will it change my quotes?
It normalises quoting where it is safe to do so. Values that need quotes stay quoted.
Why did the first run take a second?
The formatter engine is downloaded when you first use the page. Afterwards your browser caches it.