YAML Formatter & Validator

Validate YAML syntax and normalize the indentation

Runs in your browserDebugging01Formatters & Validators

What is YAML Formatter & Validator?

A YAML validator parses YAML text, reports the line number of any syntax error, and can re-emit the content with consistent indentation. It is the fastest way to track down indentation and type problems in Kubernetes manifests, CI pipelines, and docker-compose files, and parsing happens inside the browser.

How to use YAML Formatter & Validator

  1. 1Paste your YAML; multi-document files separated by --- are supported.
  2. 2Read the validation result — on success it lists how many documents were parsed and their top-level keys.
  3. 3When it fails, jump to the reported line number; nearly every YAML error comes from indentation or a missing space after a colon.
  4. 4When you want a consistent style, replace the original file contents with the normalized output.

How do I do this in code?

Use the tool above for one-off work; for anything you repeat, move it into a script or your project.

# Validate and print the normalized result
yq . config.yaml

# Validate only
python -c "import sys,yaml;yaml.safe_load(open(sys.argv[1]))" config.yaml

Common errors and how to fix them

SymptomCauseFix
mapping values are not allowed hereA colon is missing the space that must follow it, or two colon-separated structures ended up on the same line.Make sure every key: value pair has exactly one space after the colon.
found character that cannot start any tokenTab characters were used for indentation, and the YAML spec permits spaces only.Replace every tab with spaces and disable tab indentation in your editor.
on is parsed as the boolean trueYAML 1.1 treats on/off/yes/no as booleans, which regularly mangles the on: key in GitHub Actions workflows.Quote the value whenever you need a string, for example "on".

Frequently asked questions

My YAML reports an indentation error but the file looks fine — how do I debug it?+

Check three things first: whether tabs and spaces are mixed, whether the dashes of a list line up with their parent key, and whether sibling keys are indented by exactly the same amount. Once you paste the document here, the reported line number is usually the first place where the indentation level stops being consistent.

Can it validate that my Kubernetes manifest fields are correct?+

This tool validates YAML syntax only, not the Kubernetes schema. A manifest can be syntactically perfect and still be rejected by kubectl because a field name is misspelled; for schema validation use kubeconform or kubectl --dry-run=server.

Related tools

All tools