YAML Beautifier
Beautify YAML in your browser. Reformat compact or messy YAML into clean, indented code. Powered by js-yaml 4.x, runs entirely in your browser. Works on Kubernetes manifests, GitHub Actions, Ansible playbooks.
Messy in, clean out
Same data, structured for human eyes. Beautify expands compact YAML into a line-per-key, properly indented document.
name: hcodx items: [1, 2, 3]
name: hcodx items: - 1 - 2 - 3
What you'll use this for
Anywhere unreadable YAML shows up — Kubernetes manifests, CI pipelines, Ansible playbooks, compose files.
Kubernetes manifests
Reformat manifests after editing — consistent indent, no surprises for kubectl.
GitHub Actions
Tidy a .github/workflows/*.yml after merging changes.
Ansible / Compose
Format playbooks and compose files to a single shared style.
OpenAPI specs
Pretty-print a YAML OpenAPI spec for diffs and review.
How to beautify YAML
Paste your YAML
Drop it into the left editor. Compact flow-style or block-style YAML both work.
Pick indent
2 spaces by default. Switch to 4 spaces or tab to match your project style.
Click Beautify
Or leave auto-format on for live updates. Runs locally with jsyaml.load + jsyaml.dump.
Copy or download
Copy to clipboard, save as .yaml, or flip the Mode to Minify to compact back.
Frequently asked questions
YAML comments are preserved when possible during reformatting. Note: js-yaml strips comments that appear inside compact flow-style structures; preserve them by editing in block style.
Yes — works well on Kubernetes manifests, Helm charts, and Docker Compose files. Reformats indentation consistently to match the YAML 1.2 spec.
Yes. No signup, no limits, no ads.
No. js-yaml is loaded once from a CDN; everything runs locally.
By default they're inlined (noRefs: true). To preserve &name / *name refs, modify the call to jsyaml.dump with noRefs: false.
About this beautifier
YAML beautification is a one-pass operation: jsyaml.load parses the input into a JS value, then jsyaml.dump serializes it again with explicit indentation. The result is canonical block-style YAML conforming to the YAML 1.2 spec — same structure regardless of whether the input was flow-style, compact, or hand-typed.
What it does
- Indents at 2 spaces (default), 4 spaces, or tab.
- Block style by default — one key per line in maps, one item per line in sequences.
- Optional sort alphabetizes keys recursively (toggle).
- Minify mode flips to flow-style output for compact single-line YAML.
- YAML 1.2 via js-yaml 4.x — broad tag, scalar, and Unicode support.
What it doesn't do
- Round-trip comments perfectly. js-yaml does not preserve inline comments in all edge cases. Block comments at the top usually survive; expect some loss in complex docs.
- Preserve anchors & aliases by default. They're inlined (
noRefs: true) for readability. Toggle source if you need to retain&name/*namereferences. - Schema validation. Syntactic only — use the YAML validator for structural checks.