YAML formatter, validator and comment remover
Runs locallyFormat, tidy, strip comments and validate — with the line and column of any error.
YAML
Valid · 1 document · 32 keys · depth 8 · 5 comments · 1 anchor · 2 aliases
Result
About the YAML formatter
How it works in 4 steps · 4 common use cases · 4 questions answered
About the YAML formatter
How it works in 4 steps · 4 common use cases · 4 questions answered
How it works
- 1.Paste a YAML file — a single document or several separated by ---.
- 2.Validation runs as you type: the line and column of any syntax error, or a summary of the document.
- 3.Format reparses and re-emits with your indent, wrap, quoting and sorting options. Tidy fixes whitespace and tabs without touching comments.
- 4.Remove comments strips every # comment and leaves the rest of the file byte for byte as it was. Copy the result, or send it back to the editor to run another action.
Common use cases
- •Cleaning a hand-edited Kubernetes or Compose file before committing it
- •Stripping the commentary out of a config before pasting it into a ticket
- •Finding the line a "bad indentation" error is really talking about
- •Fixing an editor that inserted tabs into a YAML file
FAQ
Why does Format lose my comments?
Because Format parses the document and writes it out again, and the YAML parser does not keep comments. Tidy is the comment-preserving option: it only touches whitespace, tabs and blank lines.
Will Remove comments break a string containing a #?
No. A # only starts a comment at the start of a line or after a space, and never inside quotes or a block scalar, so a URL fragment, a "50% # done" string and a shell script in a | block all survive intact.
Does it handle multi-document files?
Yes. Documents separated by --- are validated and re-emitted individually, which is what Kubernetes manifests usually look like.
What happens to anchors and aliases?
They are kept by default. Tick "Expand anchors" to resolve them and write the values out in full, which is useful when you want to see what a merge key actually produced.