Skip to content

Format, validate, re-indent, and beautify YAML markup with optional key sorting.

Loading tool

About YAML Prettify

Validate YAML and re-emit it in consistent block style with 2 or 4 space indentation, using js-yaml. Multi-document files separated by --- are supported, keys can be sorted alphabetically, you can choose single or double quotes for values that need quoting, and deeply nested collections can be written in compact flow style. Parse errors show the line and column. Comments are not preserved, because the YAML is parsed into data and dumped again.

Common uses

  • Normalize a Kubernetes manifest or Docker Compose file that mixes flow and block styles.
  • Find the line and column of an indentation error in a CI config.
  • Sort keys to make two YAML files easier to diff.
  • Convert {inline: maps} into readable block-style YAML.

FAQ

Why were my YAML comments removed?
The formatter parses YAML into data and serializes it again, and comments are not part of the data model, so they are dropped. Keep a copy of the original if you need the comments.
Can YAML use tabs for indentation?
No. The YAML specification forbids tab characters for indentation; only spaces are allowed.
What does --- mean in YAML?
--- marks the start of a new document, which lets one file hold several documents, as is common with Kubernetes manifests.