Search tools

Find a tool by name or what it does.

YAML Formatter & Validator

Validate a YAML document and reformat it in a clean, canonical form, with sorted keys, quote and indent control, and errors that point at the exact line.

Validated and reformatted live as you type. Nothing leaves your browser.

Indent

Key order

Quote style

Collections

Line width

Formatted YAML

Formatted YAML will appear here.

How to format and validate YAML online

  1. Paste your YAML

    Drop a YAML document or a multi-document stream into the input, and it is parsed and reformatted live as you type.

  2. Fix any errors

    If the YAML is invalid, the badge turns red and the error names the line and column where parsing failed so you can correct it.

  3. Adjust the formatting

    Set the indent width, key order, quote style, collection style, and line width, and the canonical output updates instantly.

  4. Copy the result

    Click Copy YAML to take the formatted document to your editor, or download it as a .yaml file.

Why use this tool

Validate as you type

Every keystroke is parsed. A badge confirms valid YAML, and invalid input shows the exact line and column that failed, with a pointer at the offending character.

Canonical, consistent output

Re-indent with 2 or 4 spaces, sort mapping keys alphabetically, and switch lists and maps between block and flow style. The output regenerates the moment you change an option.

Quote and line-width control

Keep quoting minimal or quote every value, and cap the line width at 80 or 120 characters, or turn wrapping off entirely for long values.

Multi-document streams

A stream of several documents separated by --- is validated and reformatted together, with each document kept in place and a count shown next to the badge.

Anchors kept where possible

Repeated structures are re-emitted as anchors and aliases instead of being duplicated, and standard tags survive the round trip.

Runs entirely in your browser

Everything happens on your device. Config files that name internal hosts, tokens, or secrets are never uploaded.

About this tool

This tool checks and reformats YAML entirely in your browser. Paste a document and it is parsed on every keystroke: a badge confirms the YAML is valid, or reports the exact line and column where it broke, with a pointer at the character that tripped the parser. Valid input is re-emitted in a clean, canonical form with consistent indentation, so a file that arrived with mixed spacing, stray quoting, or inconsistent list style comes back uniform.

The formatting controls sit next to the output and re-run instantly. Set the indent to 2 or 4 spaces, sort mapping keys alphabetically or keep their original order, keep quoting minimal or quote every value, render collections in readable block style or compact flow style, and cap the line width at 80 or 120 characters or leave long values unwrapped. Multi-document streams separated by --- are handled as a unit, each document reformatted in place, and repeated structures are re-emitted as anchors and aliases rather than being copied out.

YAML is where most configuration lives, from build pipelines to container manifests, and those files often carry internal hostnames, tokens, and secrets, so nothing here is uploaded. When you need a different shape, the YAML to JSON converter turns a validated document into JSON, the JSON to YAML converter makes the reverse trip, and the JSON formatter tidies the JSON once you have it.

Frequently asked questions

What does the formatter do to my YAML?
It parses the document to confirm it is valid, then re-emits it in a canonical form with consistent indentation and your chosen quote and collection style. Comments are dropped because they are not part of the parsed data.
Why does my YAML show an error?
YAML is indentation-sensitive, so a stray tab or a misaligned key is the usual cause. The error reports the line and column where parsing failed and shows the offending line, and it clears as soon as the input is valid.
Is my data uploaded anywhere?
No. Everything runs in your browser; nothing is sent to a server, stored, or logged, which matters for config files that carry credentials or internal hostnames.
Does it keep multiple documents?
Yes. A stream of documents separated by --- is validated and reformatted together, each document kept in order, and the badge shows how many were found.
What happens to anchors, aliases, and tags?
Repeated structures are re-emitted as anchors and aliases so shared data is not duplicated. Standard tags survive, but an unknown custom tag is reported as an error because it cannot be resolved.
Can I sort the keys or change the quote style?
Yes. You can sort mapping keys alphabetically, keep quoting minimal or quote every value, switch between block and flow collections, and set the indent and line width, all of which update the output instantly.

Related tools