Format and convert YAML

Free online YAML formatter and validator — catch a colon out of place in a docker-compose.yml before it breaks your deploy, verify a Helm chart, or convert a JSON snippet from kubectl into editable YAML. Paste YAML to validate syntax and re-emit with consistent indentation, or convert between YAML and JSON in either direction. Auto-detect mode picks the right operation based on input. YAML 1.2 (the modern spec — no Norway problem) with full multi-document support: files with multiple --- documents parse and re-emit correctly, matching what `kubectl apply` and `helm template` expect. Indent at 2 or 4 spaces, optionally sort keys alphabetically for deterministic git diffs.

How to use

1
Paste YAML or JSON

Auto-detect picks the right direction by default.

2
Pick indent and options

2 spaces is standard for YAML; sort-keys is helpful for diffs.

3
Read the output

Validated, reformatted (or converted) output appears on the right.

4
Copy or download

One-click clipboard or save as .yaml / .json.

Validate and reformat YAML, or round-trip between YAML and JSON — YAML 1.2 spec with multi-document support

Mode
Indent
Options
Input
Output

What you can do

Format and validate YAML
Re-emit with consistent indentation; syntax errors surface with line numbers.
YAML ↔ JSON
Round-trip between formats — auto-detection, or pick manually.
2 or 4-space indent
Match your team's convention or what your CI expects.
Sort keys
Alphabetical sort on object keys — makes diffs deterministic.
Multi-document YAML
Files with multiple --- documents parse and re-emit correctly.
Instant validation
Syntax checks run on every keystroke with line numbers on errors — no waiting on a kubectl --dry-run roundtrip to find the typo.

Typical uses

  • Validate a docker-compose.yml or kubernetes manifest before deploying.
  • Convert a JSON API config to YAML for use in GitHub Actions.
  • Normalise YAML indentation across a team — sort keys for deterministic diffs.
  • Convert a Kubernetes JSON snippet from kubectl into YAML for editing.
  • Spot a syntax error in a multi-document YAML file (a colon out of place).

Why this one

Validation is instant on every keystroke — no kubectl --dry-run roundtrip needed to find a misplaced colon. Auto-detection handles both directions; sort-keys produces deterministic output suitable for git diffs (matches what `yq -P` writes). Multi-document support means real-world Kubernetes manifests, GitHub Actions workflows and Helm chart templates round-trip cleanly.

Common questions

Why does sort-keys reorder my list?

Sort-keys only affects object (mapping) keys, not list (sequence) order. If your YAML uses ordered lists they stay ordered; if it uses keyed objects, those keys get sorted alphabetically. Same behaviour as `yq -P sort_keys(..)`.

What about YAML 1.1 vs 1.2?

This tool targets YAML 1.2 — the safer modern spec used by Kubernetes, GitHub Actions and modern Ansible. YAML 1.1 has the famous "Norway problem" where the unquoted country code `no` parses as the boolean `false`; 1.2 fixed this by requiring explicit `true`/`false` for booleans. If your file came from an older Ruby/Puppet pipeline expecting 1.1, double-check that unquoted `yes`, `no`, `on`, `off` strings round-trip as you expect.

Multi-document YAML?

Yes — documents separated by --- are parsed individually. JSON output of a multi-document YAML is a JSON array.

Anchors and aliases (&foo / *foo)?

Parsed correctly. When emitting YAML, the formatter will preserve aliases where possible (depending on flow_level), but the structure is canonicalised — your exact &/* placement may not survive a round-trip.

Mobile?

Yes — input and output stack on narrow screens.

How do you rate this tool?

Thank you for your rating!
Want to share more? Leave a comment!
Thank you! Your comment will appear after moderation.
Published Updated Authors: