YAML Formatter
Check your YAML parses, and print it with consistent indentation.
INPUT
CHARS: 0WORDS: 0LINES: 0
OUTPUT
CHARS: 0WORDS: 0LINES: 0
How the YAML Formatter works
The YAML is parsed first, including multi document files, and the first syntax error is reported with its line and column. If it parses, Prettier prints it with uniform indentation, normalized quoting and consistent spacing in flow sequences, while comments are kept.
Indentation errors are the most frequent YAML problem, since tabs are not allowed and a single misplaced space changes meaning. Formatting makes that structure visible.
YAML Formatter examples
Normalize YAML indentation and structure
Input
app: name: ConvertCasePro env: production database: url: postgresql://localhost/db
Result
app: name: ConvertCasePro env: production database: url: postgresql://localhost/db
When it is useful
- •Fixing indentation in a CI workflow or a Kubernetes manifest.
- •Checking a Docker Compose file before running it.
- •Normalizing config files that several people edit.
- •Finding the line that breaks an OpenAPI document.
Frequently Asked Questions
Why does YAML reject tabs?
The specification only allows spaces for indentation, because tabs render differently in different editors and would make the structure ambiguous.
Are comments kept?
Yes. The formatter preserves comments, unlike a conversion through JSON.
Can it convert to JSON?
Use the JSON to YAML Converter and switch the direction to YAML to JSON.
Guides that use this tool
Related tools
- JSON to YAML ConverterSwitch configuration between JSON and YAML in either direction.
- JSON Formatter and MinifierPaste JSON to validate it and print it neatly, or compress it to a single line.
- Markdown FormatterTidy a Markdown document so that lists, tables and spacing are consistent.
- XML FormatterPaste XML to check it and lay it out with clear indentation.