Dev Utilities

Check if your YAML is valid

YAML Validator runs your text through the js-yaml parser and prints Valid YAML, or an Error: message that names the line and column with the offending lines underneath. Developers use it before applying Kubernetes manifests, GitHub Actions workflows and Docker Compose files. The parser enforces YAML's actual rules: duplicate mapping keys fail, tabs used for indentation fail, while anchors, aliases and multi-line strings parse normally. Even a bare scalar like hello is a valid YAML document.

How to use YAML Validator

  1. Open YAML Validator in the Toolbox101 app.
  2. Paste the YAML to check into the YAML box. Validation reruns on every change.
  3. Read the verdict in the Output box: Valid YAML, or an Error: message with the line, column and the offending lines underneath.
  4. Fix the reported lines and confirm the verdict changes to Valid YAML.

Worked example

YAML Validator returns the output below for this input.

Input

name: api
name: api2

Output

Error: duplicated mapping key (2:1)

 1 | name: api
 2 | name: api2
-----^

Check it yourself: open YAML Validator and enter the same input.

Frequently asked questions

Why does my YAML with tabs fail validation?

The YAML specification requires indentation with spaces, so tabs used to indent are rejected with the error tab characters must not be used in indentation. Use spaces instead, matching the file's existing indentation width. Tabs remain fine inside double-quoted strings and in the content of block scalars.

Why is a duplicate key an error?

YAML forbids repeating a mapping key, so two same-named entries make the document invalid and the parser reports duplicated mapping key with the line and column. This is stricter than JSON.parse, which keeps the last duplicate; in YAML the ambiguity is treated as a mistake on purpose.

Does whitespace-only input count as valid YAML?

A document that contains only spaces or blank lines parses as an empty YAML document, so the tool prints Valid YAML for it. That is a parsing quirk rather than a bug: an empty stream is accepted. Any real content, even a bare word, also parses, because a single scalar is a valid document.

Does it accept a file with several documents?

Yes. A stream of documents separated by --- lines is checked document by document, and the verdict says how many it found, for example Valid YAML (2 documents). An error in any one of them is reported with its line and column.

Does it lint style like yamllint?

No. This tool answers one question, whether the text parses as YAML, and prints the verdict or the first parse error. Style rules such as line length, key ordering or consistent quoting are what linters like yamllint check, and they are out of scope here.

Use YAML Validator now

Runs in your browser. Nothing you type is uploaded.