YAML validator

Check YAML and get every error and warning with line and column: tabs, bad indentation, duplicate keys, undefined aliases, several documents and the

loading YAML validator
About this tool

What is a YAML validator?

YAML is the format of Kubernetes manifests, GitHub Actions workflows, Docker Compose files and countless app configs. It looks forgiving, but its meaning depends on whitespace, and small slips fail in confusing ways: a tab where spaces belong, a key repeated by copy and paste, an alias that points to nothing. Worse, some mistakes are not errors at all. They parse fine and quietly change your data.

This validator parses your text as YAML 1.2 and reports every error and warning with a line and column. It catches tabs used for indentation (YAML only allows spaces), wrong indentation, duplicate keys, an alias such as *x with no &x anchor before it, an unclosed [ or {, values that start with a reserved character such as @ or a backtick, and tags that do not fit. If the text holds several documents separated by ---, it says "N documents in this text" and reports errors in later documents with the right line number.

When the text parses, you also get the equivalent JSON with a copy button. Several documents become a list. The JSON is read as YAML 1.2, so yes and no stay text.

It runs entirely in your browser; nothing is uploaded. It checks syntax, not meaning. It does not know the schema of Kubernetes, GitHub Actions or OpenAPI, and it never executes tags.

How to validate YAML

  1. Paste your YAML into the editor. The page opens with a sample that contains a tab, an undefined alias, a duplicate key, country: no and a second document with mode: 0755.
  2. Read the list of problems. Each one has its line and column; click to jump there.
  3. Fix errors first. A tab must become spaces, a duplicate key must be renamed or merged, an alias needs its anchor defined earlier.
  4. Look at the warnings. They mark text that is valid YAML 1.2 but means something different to other parsers.
  5. When it is clean, copy the JSON or continue in the YAML formatter and tree view.

Examples

The Norway problem

country: no

In YAML 1.2 this is the text "no". In YAML 1.1, used by PyYAML, Ruby and many other tools, it is the boolean false, so a list of country codes loses Norway. The warning is on by default; the "Norway problem" box turns it off. It applies to yes, no, on and off in any capitalization. Quote the value: country: "no".

A leading zero

mode: 0755

YAML 1.1 reads this as octal, which is 493 in decimal. YAML 1.2 reads 755. For file permissions that difference matters, so quote it or check what your consumer expects.

Duplicate key and undefined alias

name: api
name: worker
ref: *base

The second name is the error, since YAML 1.2 forbids repeated keys. *base fails because no &base appears earlier.

Several documents

kind: A
---
kind: B

The tool reports two documents, and the JSON is a list of two objects.

Common errors

  • Tabs for indentation. Many editors insert tabs silently. Configure yours to insert spaces in YAML files.
  • Inconsistent indentation. Children must be indented more than the parent and siblings must align exactly. Two spaces is the usual convention.
  • A colon in a plain value. title: Note: draft breaks. Quote the value.
  • A value starting with @ or a backtick. These characters are reserved. Quote the string.
  • A missing closing bracket. An unclosed [ or { swallows the rest of the file, so the reported line can be far below the real mistake.
  • Copy and paste duplicates. Two blocks merged by hand often repeat a key.

Frequently asked questions

Is it checked against a real parser?

The parser is the yaml library (YAML 1.2). The results were also compared with PyYAML on more than 60 cases. One known difference: PyYAML accepts duplicate keys, while the YAML 1.2 specification forbids them, so this tool reports them as errors.

Does it validate Kubernetes or GitHub Actions files?

No. It checks syntax only. A file can be valid YAML and still be rejected by Kubernetes for a wrong field name. Use the tool that owns the schema for that.

Is my text sent to a server?

No. Parsing happens in the page.

Why does the JSON show no as text if PyYAML makes it false?

The JSON view follows YAML 1.2. The warning exists precisely to flag values the two versions read differently.

What about complex keys and tags?

Tags are not executed, and complex keys, such as a list used as a key, become text in the JSON, since JSON keys must be strings.

Where do I go next?

Convert with the YAML to JSON converter or the JSON to YAML converter, or check a JSON file with the JSON validator.

Report a problem