YAML Formatter
Validate and beautify YAML: consistent indentation and quotes, comments kept, and syntax errors pinned to a line and column.
0 characters · 1 line
How to use
- Paste YAML into “Input YAML”, or click “Example” to try it.
- The result appears instantly. Syntax errors show the line, column and reason (such as tab indentation or a duplicate key).
- Choose the indent, quote style and line width, or turn on “Expand one-line [ ] and { } into blocks”.
- Click “Copy” or “Download” to grab the tidy YAML.
FAQ
Is my YAML uploaded?
No. Validation and formatting happen in your browser and your data never leaves your device. The YAML library is downloaded from this site the first time you format, and is not needed again after that.
Are comments kept?
Yes. Inline and full-line comments stay where they were, and anchors (&), aliases (*), merge keys (<<) and tags (!!) are kept as written. A few comments in unusual places (inside [ ], for example) may move to a neighboring line.
Can formatting change my data?
Values stay the same. Numbers keep their exact spelling, so 0755, 0x1F, 1.0 and +12 are not rewritten as 755, 0x1f, 1 and 12. That matters because YAML 1.1 reads 0755 as octal (Ansible file modes rely on this). Switching to double or single quotes only changes how strings are written, not their content; strings with tabs or other control characters stay double-quoted.
Why are tabs not allowed for indentation?
The YAML specification only allows spaces for indentation, so tabs cause a parse error. The tool points to the first tab; after you fix it, the next error is shown.
Can it handle several documents separated by ---?
Yes. Each document is formatted on its own, and the --- and ... markers are kept. The number of documents is shown below the result.
What does “Line width” do?
By default nothing is wrapped. With 80 or 120 characters, long strings are folded over several lines. Under YAML’s rules each fold reads back as a single space, so the content does not change.
Related tools
JSON to YAML
Convert JSON to YAML and YAML to JSON, keeping key order and pointing to the line and column of syntax errors.JSON Formatter
Beautify, minify and validate JSON with precise line and column error locations.XML Formatter
Beautify, minify and validate XML, keeping comments and CDATA, with line and column locations for syntax errors.