YAML Formatter and Validator
Validate YAML and reformat it with consistent 2 or 4 space indentation, optional key sorting and every document in a multi-document file.
Free · No sign-up · Your inputs stay in your browser
Input
Format and validate YAML
Output
Formatted YAML
1 document, contains yes/no/on/off: YAML 1.1 parsers read those as booleans
Parsed with js-yaml as YAML 1.2, then written back in block style. Comments are not part of the data model, so they are dropped: format a copy, not the only one. Anchors and aliases are expanded.
Runs in this browser. Nothing you paste is sent to a server.
About this tool
Method, assumptions, practical next steps, and limits.
The errors YAML is known for
Tabs are not allowed for indentation, a colon followed by a space inside an unquoted value starts a new mapping, and in YAML 1.1 parsers the words yes, no, on and off are booleans (the Norway problem: the country code NO becomes false). Kubernetes and Docker Compose use YAML 1.1 style parsers in places, so quote those values. The YAML 1.2.2 specification is the reference.
What formatting loses
Comments are not part of YAML's data model, so a parse and re-dump drops them, and anchors are expanded. Format a copy, or use a comment-preserving formatter such as yamlfmt or Prettier in a repository.