YAML Formatter & Validator

One input per line. Output is numbered to match the input order.
Pinned tools are listed in your favourites on the home page.Copies a link to this tool that carries your current input, so it opens ready to run.Gives you an iframe snippet for putting this tool on your own site.
Ctrl+Enter Run  · Ctrl+Shift+C Copy  · Esc Clear

Understand YAML Formatter & Validator

This formatter re-prints YAML with consistent indentation and reports the structures it cannot read.

How it works

YAML uses indentation rather than brackets to express nesting, so the parser tracks how many spaces each line begins with and builds the mapping from that. Values are then typed by their text: true and false are booleans, null and ~ are null, a bare number is a number, and everything else is a string unless quoted. The output is re-serialized from the parsed values, which is why it comes back uniform — and why any comment in the original is gone.

When to use it

  • Checking a GitHub Actions workflow or a Kubernetes manifest before you push it.
  • Finding the line where a pasted block landed at the wrong indentation level.
  • Normalizing indentation across a config file that several people have edited.
  • Confirming that a value you meant to be a string is not being read as a number or a boolean.

Watch out for

  • Tabs are never legal for indentation in YAML. A single tab an editor inserted is a syntax error in every conforming parser, and it is invisible — this is the most common reason a manifest fails.
  • In YAML 1.1, still the default in PyYAML and much older tooling, the unquoted values yes, no, on, and off are booleans, so a country field of NO becomes false. That is the Norway problem. This tool follows YAML 1.2 and treats them as strings, so quote them regardless and the two agree.
  • Comments are not preserved. Reformatting returns the data, not the file, so do not paste the result back over a config whose comments you need.
  • This handles the shape most config files have: top-level keys, nested mappings, and simple lists. Anchors and aliases (&defaults, *defaults), block scalars (| and >), and multi-document files separated by --- are not reproduced.

Not the right tool for: Validating a manifest against its schema. The syntax can be perfect while every field is wrong; kubeconform, actionlint, or the platform's own validator check that.

Frequently Asked Questions

Why is my YAML invalid?

Common YAML errors: tabs instead of spaces for indentation (YAML requires spaces), inconsistent indentation levels, unquoted special characters (: { } [ ] , # & * ? | - < > = ! % @ `), and special values like "yes" or "no" treated as booleans unexpectedly.

How do I include a colon in a YAML value?

Colons followed by a space start a key: value pair in YAML. To include a literal colon in a value, quote the entire string: message: "Error: connection failed" or use a block scalar (|) for multiline values.

What YAML version does this use?

This formatter uses YAML 1.2, which is stricter than YAML 1.1. Unlike 1.1, YAML 1.2 only treats true/false as booleans (not yes/no/on/off), making it fully JSON-compatible.

How to Use YAML Formatter & Validator

  1. Paste or type your input in the input area above.
  2. The tool processes your input automatically or click Run.
  3. Copy or download the result using the action buttons.
  4. Use Ctrl+Enter to run quickly from the keyboard.