YAML formatter

Format, validate and lint YAML, or convert it to JSON. Errors and common pitfalls are explained in plain English.

Advertisement
Indent
Output
Paste YAML to format and check it.
Checked as you type
Comments are kept
Advertisement

How to format and validate YAML

  1. Paste your YAML into the left-hand box (the top box on a phone).
  2. If it’s valid, the formatted version appears straight away, with any warnings listed above it. If not, the message shows the line and what to fix.
  3. Choose 2 or 4 spaces, or JSON to convert it, then press Copy.

What the linter checks

Frequently asked questions

How do I format YAML?

Paste your YAML into the box. It’s checked and reformatted as you type, with consistent indentation and spacing. Choose 2 or 4 spaces, then press Copy. Comments and the order of your keys are kept unless you tick Sort keys.

How do I convert YAML to JSON?

Paste your YAML and choose JSON as the output. Anchors and aliases are expanded, and large numbers are kept exactly. If the file contains several documents (separated by ---), the JSON is a list with one item per document.

Why does it warn about yes, no, on and off?

In YAML 1.1, which tools such as PyYAML and Ansible still use, unquoted yes, no, on and off are read as true or false. That’s why a country code like no (Norway) can turn into false. Put the value in quotes if you mean the text.

Why does it warn about version numbers?

An unquoted value like 1.10 is read as the number 1.1, so the trailing zero disappears. Put version numbers in quotes, like "1.10".

Can I use tabs in YAML?

No. YAML only allows spaces for indentation. Werdz shows the line where a tab was used so you can replace it with spaces.

Is my YAML private?

Yes. Everything happens in your browser, and your YAML is never uploaded or saved, so it’s safe for config files that contain internal hostnames or secrets.

More free text tools