Skip to content

YAML Formatter

Paste YAML with inconsistent or ragged indentation and get it re-serialized with a clean, uniform indent — or just validate it without changing anything — using the same parser under the hood as the JSON/YAML Converter, since hand-rolling YAML parsing correctly is genuinely hard.

  • Normalizes indentation to a fixed, consistent size
  • Validate mode checks syntax without reformatting
  • Syntax errors include the line number
  • Catches duplicate keys, which YAML silently allows in some parsers
  • Runs fully client-side

Formatter

Parsed locally, nothing uploaded

Output

How to format YAML

  1. 01

    Paste the YAML

    Mixed or ragged indentation is exactly what this fixes.

  2. 02

    Pick an indent size

    2 spaces is the most common convention; some tools (like some Kubernetes configs) use different sizes.

  3. 03

    Fix anything flagged

    A syntax error names the line — YAML is whitespace-sensitive, so the error is usually a stray space or a mismatched indent level.

Why this is separate from the JSON ↔ YAML converter#

This site already has a JSON/YAML Converter for moving data between the two formats. This tool is different: it never leaves YAML — it parses the document and re-serializes it as YAML again, purely to normalize indentation and catch syntax errors, for the much more common case where you already have YAML and just want it cleaned up, not converted to something else.

Why re-parsing catches things a text editor cannot#

YAML's indentation carries structural meaning — two spaces of drift can silently change which key a value belongs to, or turn a nested map into a sibling. A text editor's auto-indent can only guess at intent; parsing the document properly and re-serializing it from the actual parsed structure is the only way to guarantee the output means exactly what the input meant, just formatted consistently. This tool uses the same real YAML parser as this site's JSON/YAML Converter rather than a hand-rolled indentation fixer, for the same reason: YAML's rules around anchors, multi-line strings and implicit typing are easy to get subtly wrong by hand.

Duplicate keys: an error some other parsers let through#

The YAML spec says duplicate keys at the same level should be treated as an error, but not every parser enforces that — some silently keep only the last value, hiding a real bug (an accidentally duplicated key nobody meant to repeat) as if nothing were wrong. This tool's validation catches duplicate keys as a genuine error, matching the stricter, spec-correct behavior.

Frequently asked questions

How is this different from the site's JSON/YAML Converter?

The converter moves data between JSON and YAML. This tool stays entirely in YAML — it re-serializes your document to fix indentation and catch syntax errors, for when you already have YAML and just want it cleaned up.

Why does duplicate keys get flagged as an error?

The YAML spec treats duplicate keys at the same level as invalid, though some parsers silently keep only the last value instead of erroring. This tool enforces the stricter, spec-correct behavior so an accidental duplicate key does not slip through unnoticed.

Can this fix a syntax error automatically?

No — a genuine syntax error (like an unterminated bracket) has to be fixed by hand first. This tool tells you exactly which line it is on so you know where to look.

Is my YAML sent anywhere?

No. Parsing and formatting run entirely in your browser — nothing is uploaded.

Developers

UUID Generator

Generate cryptographically random UUID v4 or time-ordered UUID v7, in bulk.

Developers

Base64 Encoder & Decoder

Encode and decode Base64 with correct UTF-8 handling, including the URL-safe alphabet.

Developers

ULID Generator

Generate ULIDs — sortable by creation time like UUID v7, but Crockford Base32 instead of hex.