YAML Formatter
Format and validate YAML files.
About the YAML Formatter
Reindents YAML to a consistent 2 or 4 spaces and rewrites inline maps and lists into block form, which is the style most Kubernetes manifests, GitHub Actions workflows, and Compose files are written in. Invalid YAML fails with the parser's own message rather than quietly producing something wrong. The document is parsed and re-emitted in your browser tab, so a values file full of secrets stays local.
How to use the YAML Formatter
- Paste your YAML into the input panel, or press Sample to load an example.
- Choose 2 spaces or 4 spaces from the Indent selector.
- Press Format to reindent the document.
- Use Copy to take the result, or Download to save it as formatted.yaml.
Frequently asked questions
- Does formatting keep my comments?
- No. The document is parsed into data and re-emitted, and YAML comments are not part of that data, so they are dropped. Keep the original if the comments matter.
- Why do I get "expected a single document in the stream"?
- The input holds more than one document separated by ---. Format each document on its own and rejoin them with the separator afterwards.
- What happens to anchors and aliases?
- They are resolved. An alias is replaced by a full copy of the value it pointed at, so the output is longer but means the same thing.
- Does it reorder my keys?
- No. Key order is preserved exactly as written, and long values are not wrapped onto a second line.
- Is my YAML uploaded anywhere?
- No. Parsing and formatting run in JavaScript in your browser tab and there is no backend to send anything to, which matters because YAML files so often carry cluster config and credentials.