Skip to content
100% local

YAML formatter

Validate and reformat YAML, with clear line and column errors.

Input
Output

YAML formatter

YAML shows up everywhere from Kubernetes manifests to GitHub Actions workflows and application config, and it's unforgiving about whitespace: a single misaligned space breaks the whole document. This tool checks a YAML document's syntax and reprints it consistently, so you can catch a broken pipeline or config file before it ever runs.

Paste a document and it's parsed immediately. Valid input comes back reformatted with your chosen indent width; invalid input returns the exact line and column of the problem along with what the parser expected there, so you're not left guessing which of forty lines has the stray tab. Two checks run automatically on every valid document: a warning if any line uses a tab for indentation, since the YAML spec forbids tabs there even though many editors insert them by default, and a count of duplicate keys within the same mapping, which YAML allows but which usually means the last one silently wins and the others were dead weight.

The options control shape as well as whitespace. Sort keys alphabetically to get a deterministic, diffable document — handy when a generated config keeps producing noisy git diffs for no functional reason. Collapse short lists turns a scalar sequence like a three-line list of tags into a single flow-style line such as tags: [a, b, c]; leave it off and any inline flow lists in the input are expanded back into one item per line instead, which is usually easier to review and merge. Remove comments strips both full-line and trailing hash comments for a version meant to be minified or shared without notes, while keeping them off preserves your document's comments exactly as written.

Formatting runs entirely in your browser. The YAML you paste is never uploaded, logged or sent anywhere — it's parsed, reformatted and displayed locally, and it disappears the moment you close or reload the tab.

FAQ

Is my YAML uploaded anywhere?
No. Parsing and formatting happen entirely in your browser's JavaScript engine. Nothing you paste is sent to a server, logged or stored outside your own device.
What does the line and column in an error mean?
They point to the exact spot in your document the parser stopped understanding, counting from the top and left of the text you pasted. It also names what it expected there, such as consistent indentation or a value after a colon.
Why does it warn about tabs?
The YAML specification forbids using tab characters for indentation — only spaces are allowed. A document with tab indentation can parse inconsistently, or fail outright, in a different YAML implementation, so the tool flags it even when your input still parses here.
What happens to duplicate keys?
YAML permits repeating a key inside the same mapping, and most parsers quietly keep only the last value. The tool doesn't reject that, but it counts the duplicates and marks the affected line so you can decide whether it was intentional.
Can it fix invalid YAML for me?
No — it reports exactly where parsing failed so you can fix the source. Automatically guessing a fix for broken indentation would risk changing what the document means.