YAML Formatter & Beautifier
Format, beautify, minify, and sort YAML with proper indentation. Perfect for Kubernetes manifests, Docker Compose, GitHub Actions, and config files.
Related Tools
YAML Syntax Reference
| Construct | Syntax | Description |
|---|---|---|
| Mapping | key: value | Key-value pair (colon + space) |
| Sequence | - item | List item (dash + space) |
| Nested | key: value | Indentation creates hierarchy |
| String | name: hello | Unquoted, single, or double quotes |
| Multiline (literal) | text: | | Preserves newlines exactly |
| Multiline (folded) | text: > | Folds newlines into spaces |
| Comment | # comment | Comments start with # |
| Document start | --- | Marks beginning of a document |
| Null | value: null | Or ~ or empty value |
| Boolean | flag: true | true/false, yes/no, on/off |
| Anchor | &name value | Define reusable value |
| Alias | *name | Reference an anchor |
Frequently Asked Questions
What is YAML used for?
YAML is a human-readable data serialization format widely used for configuration files. Common uses include Kubernetes manifests, Docker Compose files, GitHub Actions workflows, Ansible playbooks, and application config files.
Does 'Sort Keys' sort nested keys too?
Currently, Sort Keys sorts top-level keys alphabetically while preserving nested structure. This is useful for standardizing configuration file order (e.g., alphabetical sections in a docker-compose.yml).
What does 'Minify' remove?
Minify removes blank lines, comments, and trailing whitespace while preserving the essential YAML structure. It reduces file size while keeping the document valid and parseable.
Should I use 2 spaces or 4 spaces for YAML?
2 spaces is the most common convention, especially in Kubernetes, Docker Compose, and GitHub Actions. 4 spaces provides more visual separation for deeply nested structures. Tabs are valid but rarely used in YAML.
Is this tool safe for production YAML files?
Yes — all processing happens in your browser. No data is sent to any server. However, always review formatted output before replacing production configs, especially for files with anchors, aliases, or complex multiline strings.