YAML Formatter
Paste YAML on the left, get a formatted (or validated) result on the right. Errors include line and column. Your data never leaves your browser.
How to use YAML Formatter
- 1
Paste or drop YAML
Paste YAML text into the left pane, or click Load file to open a .yaml or .yml file from disk.
- 2
Pick a mode
Format normalises whitespace and indentation, Sort keys produces a canonical form for diffing, and Validate just reports whether the input parses.
- 3
Choose indentation
Pick two- or four-space indentation. The setting controls block-style nesting in the output.
- 4
Read the result
Parse errors appear above the panes with line and column. The Valid / Invalid badge tracks the current input.
- 5
Download or copy
Click Download .yaml to save the formatted result, or use the Copy button on the right pane.
Frequently asked questions
- Does this tool upload my YAML?
- No. Every parse, transform, and download runs entirely in your browser using JavaScript and Web Workers. The file never leaves your device — there is no upload endpoint and no server-side processing.
- Which YAML version is supported?
- js-yaml's CORE_SCHEMA is used (a YAML 1.2 superset of the JSON schema). Anchors, aliases, multi-document streams, and block / flow styles all parse correctly. Custom !tag types are not registered.
- Why does Sort keys reorder my comments?
- YAML serializers cannot preserve comments through a parse / re-emit cycle — the AST drops them. If you need comment-preserving formatting, edit the file directly in your editor instead of using Sort keys.
- What does Sort keys do to lists?
- List order is preserved exactly. Only object (mapping) keys are sorted, and the sort applies recursively to every nested mapping.