About Format YAML Online
Paste your YAML and get clean, consistently indented output. Syntax errors are detected with line numbers.
Frequently Asked Questions
What is a YAML formatter?
A YAML formatter validates and re-serialises a YAML document with consistent indentation, normalised scalar representation, and clean list/mapping syntax. It catches indentation errors, duplicate keys, and invalid syntax, reporting the exact line where each error occurs.
How do I fix "tabs are not allowed in YAML" errors?
YAML strictly prohibits tab characters for indentation — only spaces are valid. Open the file in your editor and replace all leading tabs with spaces. In VS Code: Ctrl+Shift+P → "Convert Indentation to Spaces". The formatter will also report the line number of the first tab found so you can fix it directly.
Does the YAML formatter preserve comments?
Yes. Unlike JSON, YAML supports comments (#) and this formatter preserves them during reformatting. Comments on their own line and end-of-line comments are both kept. Comments attached to specific keys remain with those keys after the YAML is re-indented.
What are YAML anchors and aliases, and does the formatter support them?
A YAML anchor (&name) marks a value to be reused; an alias (*name) references it. This avoids repeating the same block (common in Docker Compose and GitLab CI). The formatter preserves anchors and aliases in place rather than expanding them — expanding would duplicate content and defeat their purpose.
Why is YAML used for Kubernetes configuration instead of JSON?
Both are valid for Kubernetes resources, but YAML is the convention because it is more readable for multi-field resource definitions, supports comments for inline documentation, and has cleaner multi-line string syntax (for scripts or certificates). JSON is still accepted by the Kubernetes API and kubectl.
Advertisement300 × 250
Advertisement300 × 250