YAML Validator

Validate YAML in two passes. First, a full YAML 1.2 parser (js-yaml) checks the syntax and reports the first error with its line and column: bad indentation, tabs, unclosed quotes or brackets, and keys repeated in the same mapping. Second, a line-by-line check warns about unquoted values that YAML 1.1 parsers such as PyYAML read as something else, like no, 3.10, 01234 and 22:22. Everything runs in your browser.

How to use the YAML Validator

  1. Paste your YAML: a Kubernetes manifest, a Docker Compose file, a CI workflow, an Ansible playbook or any config file.
  2. Press Validate. A green line means every document parsed; files with several documents separated by --- are all checked.
  3. Fix the error first if there is one (the parser stops at the first error), then review the yellow warnings.

Load example validates this file:

country: no
python_version: 3.10
zip: 01234
ports:
  - 22:22
database:
  host: localhost
  port: 5432

It is valid YAML, and you get four warnings: line 1, no is a boolean in YAML 1.1; line 2, 3.10 is a number, so it becomes 3.1; line 3, 01234 has a leading zero; line 5, 22:22 is the base-60 number 1342 in YAML 1.1. Quoting each value removes the warning.

Errors vs warnings: what each pass checks

Errors come from the parser and mean the file is not valid YAML. Common ones:

  • Duplicated mapping key. The same key twice in one mapping, such as a: 1 … a: 3 at the top level, or two port: lines under db:. The error points at the second occurrence. Repeating a key in different list items is fine: in a Kubernetes env: list, every item has its own name and value.
  • Tabs in indentation. YAML indentation must use spaces.
  • Unclosed quotes or brackets, such as a: "unterminated or a: [1, 2.
  • Wrong indentation, where a line is indented in a way that fits neither the parent nor a sibling.

Warnings do not make the file invalid. They flag plain (unquoted) values whose type depends on the YAML version of whoever reads the file. YAML 1.2, which this validator uses, reads them one way; YAML 1.1 parsers such as PyYAML, still common in Python tooling, read them another:

ValueYAML 1.1 (e.g. PyYAML)YAML 1.2
no, yes, on, offbooleanstring
01234octal number (or a number without the zero)number
22:22base-60 number 1342string
3.10number 3.1number 3.1

The last row is a problem in every version: an unquoted version number loses its trailing zero. Quoted values, keys, comments and the text inside | and > block strings are never flagged.

Common use cases

  • Before committing a CI workflow or manifest, to catch a syntax error locally instead of in a failed pipeline run.
  • Docker Compose port mappings: an unquoted - 22:22 is the classic base-60 trap, which is why the Compose documentation recommends quoting ports.
  • Config read by Python tools (PyYAML-based), where country codes such as NO and values such as off silently become booleans.
  • Reviewing a merge, where two branches added the same key and the result has a duplicate that some parsers silently resolve by keeping the last value.

Limits

  • The parser reports the first error only; fix it and validate again to see the next one.
  • Warnings are line-based hints. They do not check flow collections ([ ], { }) or keys, so a key named on:, as in GitHub Actions workflows, is not flagged.
  • The validator checks YAML, not a schema: it does not know which fields a Kubernetes Deployment or a GitHub workflow requires.

Frequently asked questions

My file works in my app, so why is there a warning?

Warnings are about portability. A value such as off is a string for YAML 1.2 parsers and a boolean for YAML 1.1 parsers such as PyYAML. If every tool that reads the file agrees, you can ignore the warning; quoting the value makes it unambiguous.

Is a duplicate key really an error?

Yes. The YAML specification requires keys in a mapping to be unique, and this parser rejects duplicates. Some other parsers silently keep the last value, which hides the mistake.

Why is the same key in two list items not a duplicate?

Each list item is its own mapping. - name: A and - name: B are two mappings that each have one name key.

Is my YAML uploaded?

No. Validation runs in your browser with a local copy of js-yaml; the page makes no request with your input.
Embed this tool on your site

Free to embed, no attribution required (but appreciated). Paste this where you want the tool to appear: