YAML Formatter
Tidy up YAML without losing what matters. Comments, anchors, aliases, tags, block scalars, and key order are preserved. Keys are never sorted unless you explicitly ask, and aliases are never silently expanded.
How to use the yaml formatter
- Paste or upload YAML (.yaml or .yml).
- Choose indentation and YAML version (1.2 by default).
- Press Format. Comments, anchors, aliases, tags, and key order are preserved.
- Keys are never sorted and aliases are never expanded unless you explicitly ask.
Example: Tidying YAML without losing comments
# db config
host: localhost
port: 5432# db config
host: localhost
port: 5432Comments and structure are preserved; only inconsistent spacing is normalized.
Frequently asked questions
- Will formatting remove my comments?
- No. The formatter preserves comments, anchors, aliases, tags, block scalars, and key order. It never performs destructive changes silently.
- Does it expand anchors and aliases?
- No. Anchors (&name) and aliases (*name) are kept as-is. They are only expanded if you convert to JSON, and you are warned when that happens.
- Can I sort keys?
- Only if you opt in. Sorting is off by default and, when enabled, the tool notes that it changed the original order.