YAML Formatter & Validator

Check YAML and tidy its indentation, with comments kept and errors shown by line.

Options
Formatted YAML

Examples

Questions

What errors does it catch?

Anything the YAML 1.2 spec does not allow: bad indentation, a duplicate key, an unclosed [ or {, a tab used for indentation, and a key and value on the wrong lines. The first error is shown with its line and column.

Are comments kept?

Yes. Comments stay next to the lines they belong to. Only spacing and indentation change.

Can it format a file with several documents?

Yes. Documents separated by --- are each checked and formatted, and an error names the document it is in.

Why is my "no" still a string?

This tool follows YAML 1.2, where no, yes, on and off are plain strings. Older YAML 1.1 readers such as PyYAML treat them as booleans, so quote them if another tool will read the file.

Is my YAML uploaded?

No. The YAML library loads once from this site, and checking runs in your browser.