YAML Formatter and Validator
Tidy and validate YAML with consistent indentation.
YAML Formatter
Developer tool running locally in browser
What does YAML Formatter do?
Normalise YAML formatting: consistent indentation, tabs converted to spaces, and quoting applied only where it is required. Invalid YAML is reported with the exact line so you can fix it before committing.
How to Use YAML Formatter
- 1Paste your YAMLMessy indentation is fine — that is the point.
- 2Set the indent widthTwo spaces is conventional.
- 3Copy the formatted YAMLReady to commit.
Key Features
- Consistent indentation at a width you choose
- Tabs converted to spaces, which YAML requires
- Minimal quoting, applied only where the value would be ambiguous
- Syntax errors reported with line and column
- Handles multi-document files
Frequently Asked Questions
Why can I not use tabs in YAML?
The specification forbids them for indentation, because tab width is not defined and the parser could not determine nesting reliably. The formatter converts any it finds into spaces.
How much should I indent?
Two spaces per level is the near-universal convention and what Kubernetes, GitHub Actions and Docker Compose examples all use. What matters most is being consistent within a file.
Does formatting change my values?
No. Only layout and quoting change. If a value gains quotes, it is because the unquoted form would have parsed as a different type.
Are comments preserved?
Formatting is done by parsing and re-emitting the document, so comments are not carried through. Keep a copy if your comments matter, or format by hand.
Input is processed in your browser and never transmitted. That said, treat any web page as untrusted for live production secrets — rotate anything you paste anywhere.
Related Tools
YAML to JSON Converter
Convert YAML configuration into JSON.
JSON to YAML Converter
Convert JSON into readable YAML for configuration files.
JSON Formatter
Format, validate and explore JSON with precise error reporting.
XML Formatter
Pretty-print and validate XML with proper indentation.
