📄

YAML Formatter

Format and validate YAML with normalized indentation.

🔒 Runs entirely in your browser — nothing is uploaded.

Valid YAML

How YAML Formatter works

How does the YAML formatter work?

It loads the js-yaml library from a CDN, uses jsyaml.load() to parse your YAML into a JavaScript object, then jsyaml.dump() to re-serialize it with a fixed 2-space indent and lineWidth: -1, which disables js-yaml's automatic line-wrapping of long strings.

What is it used for?

It is useful for normalizing indentation in a Kubernetes manifest, Docker Compose file, or CI config, or simply checking whether a YAML snippet parses correctly before you use it.

Does formatting preserve comments and key order?

No - because it round-trips through a plain JavaScript object, comments are stripped entirely since js-yaml does not carry them through a load/dump cycle, and quoting style or key order may shift to whatever js-yaml's dumper produces by default.