Re-indent YAML with 2 or 4 spaces
Clean up the indentation of a Compose file, a Kubernetes manifest or a CI workflow. Every value and comment stays as you wrote it; broken YAML gets the line, the column and the reason.
How to use it
Paste YAML on the left, or open a .yaml or .yml file. Choose 2 or 4 spaces, whether list items sit under their key, and whether comments stay. Copy or download the result. An error is marked in your text with its line and column.
Examples
Re-indent a Compose service
services:
web:
image: nginx:1.27
ports:
- "80:80"services:
web:
image: nginx:1.27
ports:
- "80:80"
A key written twice
name: web replicas: 2 name: api
Line 3, column 1The key "name" is written twice in this map
Some parsers, PyYAML among them, keep only the last value without a word; here the second key is marked.
What formatting changes, and what stays as written
Why no value changes
Kubernetes, Compose and GitHub Actions files
Questions
- Does it keep my comments?
Yes, each one beside the line it was on. Turn Comments off for a copy without any, for example before sharing a file. - Why does my YAML say Not valid YAML?
The status bar names the first problem with its line and column, and the spot is marked in your text. The usual causes are a tab used to indent, a key written twice, a bracket or quote left open, or a line indented one space off. - Is my YAML uploaded?
No. Everything runs in your browser, so your YAML stays on your device. Nothing you paste is uploaded unless you share a result, which is locked with your password first. Config files, Compose files and CI workflows often hold passwords, tokens or keys, and the page warns you if it spots any.