YAML Formatter
Free online YAML formatter and validator. Paste YAML to re-indent and validate it in your browser.
Suggested tools
About YAML Formatter
YAML Formatter re-indents YAML with consistent two-space indentation and checks it for syntax errors at the same time. Use it to tidy Docker Compose files, Kubernetes manifests, GitHub Actions workflows, Ansible playbooks and other config before committing them.
Anchors, aliases and merge keys (<<) are understood, and errors show the line where the YAML breaks — usually a tab, an inconsistent indent or a missing space after a colon. Everything runs locally in your browser — the text you paste is never uploaded.
How to use YAML Formatter
- Paste YAML, upload a .yaml/.yml file or click Sample.
- Press Beautify to re-indent, or Validate to check it.
- Copy or download the formatted YAML.
Key features
- Consistent two-space indentation
- Syntax check with line numbers
- Anchors, aliases and merge keys supported
- YAML 1.2 rules — yes/no/on/off stay text
Example
Inconsistent indentation and a flow list, normalised.
server:
port: 8080
host: localhost
features: [login, upload]
server: port: 8080 host: localhost features: - login - upload
When to use YAML Formatter
- Tidying YAML edited by several people with different indentation habits.
- Normalising config files before committing them.
- Checking YAML for errors while formatting it.
Tips and common problems
- Beautify removes comments; use Validate if you only want to check a commented file.
- Flow lists like [a, b] are written as block lists, one item per line.
- Anchors are expanded into their full values.
Frequently asked questions
No. Beautify rebuilds the YAML from its data, and comments are not data. Use Validate if you only want to check a commented file.
They are resolved, so the formatted output contains the full values instead of the references.
If the YAML is valid, Beautify normalises the indentation. If it is invalid, it shows the line to fix first.