Skip to main content
CalcChef

YAML Validator

Check YAML syntax as you type: line and column of the first error, a JSON view of each document, unknown tags such as !Ref listed, << merge keys optional. How it works

Use the YAML Validator

Up to 150,000 characters (a larger file is refused and not loaded). The text is checked in your browser and is not sent anywhere.

Valid YAML

1 document. The syntax is correct; the content is not checked against any schema.

{
  "name": "John Doe",
  "age": 30,
  "skills": [
    "TypeScript",
    "React"
  ]
}

Format re-writes the YAML with 2-space indentation. Comments and blank lines are dropped, because the parser does not keep them.

What this check covers

  • Syntax only, with the js-yaml parser: indentation, tabs, flow collections, duplicate keys, anchors and aliases, --- document markers, and nesting up to 100 levels. A YAML core tag on the wrong kind of node (!!int [1]) is an error; other tags are accepted and listed.
  • Not checked: Kubernetes, Docker Compose, GitHub Actions or any other schema.
  • << merge keys are not part of YAML 1.2. By default this parser shows << as an ordinary key; the checkbox merges it as YAML 1.1 tools do.
  • Anchors: at most 5,000 aliases per input (all documents together), and the displayed value is cut after 20,000 values for the whole input, because aliases can multiply a small file into billions of values.
  • The parsed view is JSON-like text: .inf and .nan are shown as YAML writes them, plain dates and date-times such as 2024-01-31 are read as timestamps (as most YAML tools do) and shown in ISO 8601, and binary values by their size.

About the YAML Validator

YAML is valid when it parses without an error; this validator checks it as you type and gives the line and column of the first error, for example "tab characters must not be used in indentation" at line 2, column 1. It checks YAML syntax only, not the schema of Kubernetes, Docker Compose or GitHub Actions, and shows each valid document as JSON-like text. Valid YAML can be rewritten with 2-space indents by Format YAML and downloaded as formatted.yaml.

Common YAML errors and what the validator reports

YAMLError shownLineColumn
a: on line 1, then a tab before b: 1 on line 2tab characters must not be used in indentation21
a: 1, then b: 2 indented by two spacesbad indentation of a mapping entry24
a: 1, then a: 2duplicated mapping key21
a: [1, 2 with no closing bracketunexpected end of the stream within a flow collection19
x: !!int abccannot resolve a node with !<tag:yaml.org,2002:int> explicit tag14

How values are read

YAMLParsed view
a: yes{ "a": "yes" }
country: NO{ "country": "NO" }
c: true{ "c": true }
d: 010{ "d": 10 }
e: 0o10{ "e": 8 }
f: .inf{ "f": .inf }
d: 2024-01-31{ "d": "2024-01-31T00:00:00.000Z" }
Value: !Ref MyBucket{ "Value": { "!Ref": "MyBucket" } }

YAML 1.2 core schema plus timestamps: only true and false are booleans, 010 is decimal, a plain date is a timestamp shown in ISO 8601, and a tag the parser does not know is kept next to its value and listed. Each view is written on one line here; the tool indents it with one key per line.

Merge keys (<<), off and on

CheckboxParsed view
Off (default){ "base": { "x": 1 }, "c": { "<<": { "x": 1 }, "y": 2 } }
Apply << merge keys{ "base": { "x": 1 }, "c": { "x": 1, "y": 2 } }

Input: base: &b {x: 1}, then c: with <<: *b and y: 2 indented under it.

What Format YAML writes

InputFormatted
a: 1 ⏎ b: ⏎ - x ⏎ - za: 1 ⏎ b: ⏎ - x ⏎ - z
# comment ⏎ base: &b {x: 1} ⏎ c: ⏎ <<: *b ⏎ y: 2 ⏎ list: [1, 2]base: &ref_0 ⏎ x: 1 ⏎ c: ⏎ <<: *ref_0 ⏎ 'y': 2 ⏎ list: ⏎ - 1 ⏎ - 2
Value: !Ref MyBucketNot offered: the tag !Ref would be lost

⏎ marks a new line. The text is parsed and written out again, so comments and blank lines go, << stays a key unless merge keys are ticked, flow style such as {x: 1} becomes block style, and anchors are renamed ref_0, ref_1. The key y is quoted because a YAML 1.1 reader would take it as true.

Frequently asked questions

How do I check if a YAML file is valid?
Paste it into the box, or open or drop a .yaml or .yml file of up to 150,000 bytes. The result updates as you type: Valid YAML with the number of documents and the parsed view, or Invalid YAML with the reason, the line and column, and the lines around the error. Empty input or only comments is No document, which is valid YAML with nothing in it.
Why does YAML say tab characters must not be used in indentation?
YAML indents with spaces only. A tab at the start of a line, as in a: followed by a tab and b: 1, is reported at line 2, column 1. Replace the tab with spaces.
Does it validate Kubernetes or Docker Compose files?
It checks their YAML syntax, not their schema. A Compose file with a misspelled key or a manifest without apiVersion is still Valid YAML here, so check the schema with the tool that reads the file.
Why is << shown as a key instead of being merged?
Merge keys come from YAML 1.1; the YAML 1.2 core schema has only the null, bool, int, float, str, seq and map tags. By default << is shown as an ordinary key. Tick Apply << merge keys and the validator merges them as Docker Compose does: c then reads { "x": 1, "y": 2 }.
Is yes or NO a boolean in this validator?
No. Only true and false are booleans, so a: yes gives "yes" and country: NO gives "NO". Numbers follow the same schema: 010 is 10 and 0o10 is 8.
Why does 2024-01-31 show as 2024-01-31T00:00:00.000Z?
The validator reads plain dates and date-times as timestamps and shows them in ISO 8601 at midnight UTC. The YAML 1.2 core schema has no timestamp tag, so a strictly 1.2 parser keeps such a date as text.

Related Tools

View all tools