YAML Formatter & Validator
Parse YAML 1.2 documents and re-emit them with consistent indentation. Comments, anchors, aliases and multi-document streams are handled by the yaml parser. Syntax errors and duplicate keys are reported without producing partial output.
🔒 100% Client-Side & Private — processed locally in your browser. Files never leave your device.
Options
Your result will appear here
Type or paste your input above, adjust the options, then press Run. Tip: press Ctrl+Enter to run, and ? for every shortcut.
How it works
Parse and re-emit with consistent indentation
The tool runs your text through a YAML 1.2 parser and writes it back out with a uniform two- or four-space indent. Because it works from parsed document objects rather than raw text edits, comments, anchors and aliases survive the round trip, and multi-document streams stay separated by document boundaries. The result is offered as formatted.yaml.
Validation before any output
Documents are parsed with duplicate-key detection enabled, so a mapping that repeats a key or a value that cannot be parsed is reported as a syntax error and no partial output is produced — you see the parser message instead of a silently mangled file. The indentation option only changes the emit indent; it does not reinterpret the structure.
Line wrapping is disabled on purpose
The emitter is set with a zero line width, which means long scalar content is not reflowed to fit a display column. This keeps block strings and flow scalars byte-for-byte faithful to what was written, which matters when the file is consumed by another tool or diffed against its original.
What is and is not standardised
Only YAML 1.2 syntax is supported — not the older YAML 1.1 tag set. Emoji and unusual scalars are preserved as written. Formatting is best-effort canonical emission, not a linter: it will not sort keys, strip blank lines, or otherwise change the meaning of the document.
Parsing stays on your device
The whole operation is string processing in this tab using the yaml package, and no network request is made, so your configuration never leaves the browser and the tool works offline. Duplicate keys and warnings are surfaced as readable messages.
Questions
Which YAML version is supported?
YAML 1.2 is parsed and emitted by the yaml package. Duplicate mapping keys and syntax errors are reported instead of silently overwritten.
Are comments, anchors and multiple documents preserved?
Yes. The formatter works with YAML document objects, retaining comments, anchors, aliases and document boundaries where present.
Does formatting wrap long lines?
No. Line wrapping is disabled so scalar content is not reflowed solely to meet a display width.
Related tools
See categoryYAML to JSON
Convert YAML to JSON locally, with indent choice and optional key sorting.
JSON to YAML
Convert JSON to YAML on your device, with a 2- or 4-space indent.
XML Formatter
Pretty-print or minify XML with a pure-JS tokenizer — comments, CDATA and PIs kept intact.
.env <-> JSON
Parse a .env file into JSON, or turn a JSON object into .env text. Runs entirely on your device.