CODDY Tool

YAML Formatter

Re-indent, compact and validate YAML — config files, Kubernetes manifests, CI pipelines.

Clean up inconsistent indentation in a YAML file, collapse it to compact flow style for a one-liner, or check that a document parses before you commit it. Runs on the same parser the JSON tool uses for its YAML conversion.

Everything you enter stays in this browser tab. Nothing is sent to our servers, logged or stored.

Loading tool…

What YAML Formatter supports

Clean up

  • Format & indent
  • Compact to flow style
  • Validate

About YAML Formatter

YAML is whitespace-sensitive in a way JSON and XML are not — two spaces where a sibling has four, or a stray tab, changes what the document means rather than merely how it looks. That makes hand-edited YAML a common source of subtle bugs, particularly in files several people edit over time: a docker-compose.yml, a GitHub Actions workflow, a Kubernetes manifest.

Formatting parses the document and writes it back out with consistent indentation throughout, which both fixes inconsistency and doubles as a validity check — a document that formats successfully is a document that parses. Compacting goes further, collapsing everything to YAML's inline flow style, which is the {a: 1, b: [2, 3]} form useful for a one-line environment variable or a compact diff.

The trade-off worth knowing: formatting is a parse followed by a fresh dump, so comments do not survive it. There is nowhere in YAML's data model — the parsed maps, sequences and scalars — to keep a comment attached to, which is true of every formatter built this way, not a limitation specific to this one.

How to format YAML

  1. Paste your YAML

    A config file, a Kubernetes manifest, anything.

  2. Choose an operation

    Format to re-indent, compact for flow style, or validate to check it.

  3. Set the indent

    Two or four spaces — tabs are not valid in YAML.

  4. Copy or download

    Take the result to your clipboard or save it as a .yaml file.

Common YAML mistakes

  • Tabs for indentation — the specification forbids them outright; use spaces only.
  • Inconsistent indentation between sibling keys, which is a parse error, not a style choice.
  • An unquoted string that looks like another type — yes, no, on, off and null are all interpreted as booleans or null unless quoted.
  • A colon inside an unquoted value, which YAML reads as starting a new key.

Frequently asked questions

Does formatting keep my comments?

No. Formatting parses the document into data and writes a new document back out, and a comment has nowhere in that data to live. This is true of essentially every YAML formatter built on a real parser, not a limitation specific to this one.

Why does validation reject valid-looking YAML?

The usual causes are a tab character used for indentation, inconsistent indentation between sibling keys, or a value that needed quoting — yes, no, on, off, true, false and null are all reserved words in YAML, not plain strings, unless you quote them.

What is flow style?

YAML's inline form, written with braces and brackets like JSON — {a: 1, b: [2, 3]} instead of a: 1 on one line and b: on the next with an indented list. Compacting rewrites the whole document this way, which is useful for a single-line value or a tighter diff.

Is my YAML sent anywhere?

No. Parsing and formatting happen entirely in your browser, which matters given how often YAML files hold connection strings, API keys and other configuration secrets.

All Developer Tools

YAML Formatter is free to use with no account, no watermark and no usage limits. Last updated 3 September 2026.