YAML Formatter / Validator

Format, validate and minify YAML in your browser, with line and column error messages, adjustable indentation, key sorting and multi-document support.

About this tool

YAML is whitespace-sensitive, so a single misplaced indent or tab can break a Kubernetes manifest, a CI pipeline or a Docker Compose file. This tool parses your YAML with js-yaml, reports the exact line and column of any syntax error, and re-prints valid documents with consistent indentation, optional key sorting, or a compact flow-style minified form. It is a formatter and validator for YAML itself; to convert between YAML, JSON and CSV use the Data Format Converter. Everything runs in your browser.

How to use it

  1. Paste your YAML into the input box. Multi-document files separated by --- are supported.
  2. Click Validate to check the syntax only, or Format to re-print it with your chosen indent (2, 4 or 8 spaces) and optional key sorting.
  3. If the YAML is invalid, the message shows the line and column of the problem so you can jump straight to it.
  4. Click Minify for a compact flow-style version, then Copy the output.

FAQ

How is this different from the Data Format Converter?

The Data Format Converter changes data between YAML, JSON and CSV. This tool keeps your data in YAML and focuses on checking and tidying it: it validates syntax with line and column errors, normalizes indentation, can sort keys and supports multi-document files.

Does formatting keep my comments?

No. The parser reads your YAML into data and the formatter writes the data back out, and comments are not part of the data, so they are dropped. Use Validate if you only want to check a file without changing it, and keep your original.

What does the minify option produce?

A compact flow-style representation, where mappings use braces and lists use square brackets, for example {name: app, ports: [80, 443]}. It is still valid YAML and parses to the same data, but it is not the way YAML is usually written by hand.

Why does YAML complain about tabs?

The YAML specification forbids tab characters for indentation; only spaces are allowed. If your file mixes them, the validator reports the line and column where it first fails, and Format will output clean space-based indentation once the file parses.

Can it handle multiple documents in one file?

Yes. Documents separated by --- lines are each validated and formatted, and the output keeps them separated by ---. The status message tells you how many documents were found.

Is my YAML uploaded anywhere?

No. Parsing and formatting happen in your browser with the js-yaml library, which is loaded the first time you use a YAML tool. Your configuration files, which often contain hostnames and settings you would rather not share, never leave your device.

Related tools

Guides & comparisons

← All tools · Blog · Cheat sheets · FAQ