YAML Formatter & Validator
Validate and re-format YAML into consistent, cleanly indented output.
How this tool works
Paste your YAML
A config file with mixed indentation or inconsistent list formatting.
js-yaml parses it
The content is parsed into a real in-memory value, catching invalid YAML along the way.
It’s re-serialized cleanly
The parsed value is dumped back out with consistent, adjustable indentation.
Copy the normalized result
Every indentation quirk from the original is replaced with one clean, consistent style.
Quick facts
- Category
- Formatters & Beautifiers
- Best for
- Normalizing inconsistent indentation in a config file
About this tool
Paste YAML with inconsistent indentation, mixed spacing, or ambiguous formatting and get it validated and rewritten with consistent, adjustable indentation, using js-yaml to parse the input and re-serialize it back into a canonical form. Because the output is generated by dumping a fresh in-memory representation rather than pattern-matching the original text, the result is normalized regardless of how inconsistently the source was written - mixed 2-and-4-space indents, inconsistent list dash placement, or extra whitespace around colons all resolve to the same clean style. If the input isn’t valid YAML, the specific parse error is shown in the status line so you can find and fix the exact problem rather than guessing. Runs entirely client-side.
Why use this tool
True parse-and-reformat
Re-serializes from a real parsed value instead of pattern-matching text, so output is always consistent.
Catches invalid YAML
A specific parse error is shown in the status line if the input doesn’t parse, not a silent failure.
Adjustable indentation
Choose 2 or 4 spaces to match your team’s convention.
Built for config files
Well suited to CI configs, Kubernetes manifests, and other YAML files edited by hand over time.
Frequently asked questions
No - because the formatter parses the YAML into a plain in-memory value and then re-serializes that value from scratch, any comments in the original source are lost in the output. If your YAML has important comments you want to keep, that’s a reason to format a copy rather than your only version of the file.
YAML allows the same data to be written many different ways - different indentation widths, inline versus block-style lists, quoted versus unquoted strings - so re-serializing a parsed value naturally produces one specific canonical style rather than preserving your original formatting choices. The data is equivalent; only the surface syntax used to represent it changes.
Explore more free tools
Formatters, converters, validators, and generators - all free and running entirely in your browser.
Browse more tools