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:
.infand.nanare shown as YAML writes them, plain dates and date-times such as2024-01-31are 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
| YAML | Error shown | Line | Column |
|---|---|---|---|
| a: on line 1, then a tab before b: 1 on line 2 | tab characters must not be used in indentation | 2 | 1 |
| a: 1, then b: 2 indented by two spaces | bad indentation of a mapping entry | 2 | 4 |
| a: 1, then a: 2 | duplicated mapping key | 2 | 1 |
| a: [1, 2 with no closing bracket | unexpected end of the stream within a flow collection | 1 | 9 |
| x: !!int abc | cannot resolve a node with !<tag:yaml.org,2002:int> explicit tag | 1 | 4 |
How values are read
| YAML | Parsed 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
| Checkbox | Parsed 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
| Input | Formatted |
|---|---|
| a: 1 ⏎ b: ⏎ - x ⏎ - z | a: 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 MyBucket | Not 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 toolsCSV to JSON
Convert CSV to JSON: the first row becomes the keys, quoted commas and line breaks are kept, and numbers and booleans are detected only if you ask.
JSON to CSV
Turn JSON into CSV: an array of objects, one object or a list of values. Flatten nested objects, expand arrays into rows, then copy or download.
XML to JSON Converter
Convert XML to JSON and JSON back to XML: attributes go under @attributes, repeated elements become arrays, and an XML error shows its line and column.
YAML to JSON Converter
Convert YAML to JSON with anchors and merge keys resolved, YAML 1.2 or 1.1 typing for yes/no, and a warning for numbers JSON cannot hold.
JSON to YAML
Convert JSON to YAML in block or flow style. Text such as yes or 017 is quoted so it stays a string, and a JSON error shows its line and column.
SQL to JSON
Turn SQL INSERT statements, or a result table pasted from psql, MySQL or Markdown, into JSON. Quoted values stay strings; numbers, true and NULL get types.