YAML Formatter
heuristic YAML spacing blank-line compaction reindent. Uses the bundled YAML parser to preserve parsed values. Formatting does not preserve comments or original scalar style. Script/settings generation remains available where provided.
Scope of this tool: Uses the bundled YAML parser to preserve parsed values. Formatting does not preserve comments or original scalar style. Script/settings generation remains available where provided.
Parser-backed YAML formatting preserves parsed values, not comments or original scalar style. Legacy tab-rewriting/compact options do not rewrite YAML values.
How to use
Use it in seconds:
- Paste your YAML into the input box.
- Choose an indent size (2 or 4) and optionally enable Compact mode.
- Click Format YAML.
- Copy the formatted result.
FAQ
What does this YAML formatter change?
It normalizes indentation (2 or 4 spaces), fixes common spacing (after : and -), trims trailing whitespace, and keeps comments.
Does it validate YAML fully?
It catches common indentation errors and tabs, but it’s not a full YAML parser/linter for every YAML feature.
Why are tabs rejected?
YAML indentation must use spaces; tabs frequently break parsers. Replace tabs with spaces before formatting.
Will my comments be kept?
Yes. Full-line and inline comments are preserved, and inline comments are normalized to a single space before #.
Does Compact mode change the data?
No. It only reduces extra blank lines and trims the output, making it shorter without changing keys/values.
Is my YAML sent to a server?
No. Formatting runs locally in your browser; the tool doesn’t make network requests.
Can I use this for Kubernetes or Docker Compose YAML?
Yes—this is great for cleaning up manifests and compose files, especially indentation and list formatting.
Continue your workflow
Browse related tools by task. Use the improved core tools for a consistent workspace with file import, downloads and clear validation errors.