YAML Validator – Check YAML Syntax Online
Paste YAML to check its syntax as you type. The YAML validator shows the exact line and column of errors, flags duplicate keys, tabs and YAML 1.1 surprises, and shows the parsed data as JSON.
Press Ctrl+Enter (⌘+Enter on Mac) to run now.
Validate YAML and See How It Is Parsed
YAML is easy to read and easy to break. One extra space, a tab or a missing colon can stop a CI pipeline or a Kubernetes deployment. This YAML validator parses your file as you type and points to the line and column of the first error with a code frame, so you can fix it before you push.
It also shows what the YAML actually means. The parsed result appears as JSON, a normalized copy shows the same data with clean indentation, and warnings highlight values that YAML 1.1 and YAML 1.2 parsers read differently, such as NO, 0644 or 22:22. Parsing uses the open-source js-yaml library in your browser.
How to validate YAML
- Paste your YAML or open a
.yamlor.ymlfile. It is checked a moment after you stop typing. - Read the status. “Valid YAML” shows the number of documents. If parsing fails, you get the line, column, reason, a hint and a code frame.
- Review the warnings for tab indentation and values that change meaning between YAML versions.
- Switch the output between the parsed JSON and a normalized YAML copy with 2 or 4 space indentation and optionally sorted keys.
- Copy or download either version.
What the YAML validator checks
- Syntax and indentation: mappings, sequences, block scalars, flow collections, anchors and aliases; the first error stops the check.
- Duplicate keys: the YAML specification requires keys in a mapping to be unique. Many parsers silently keep the last value; here a duplicate is an error, so an overridden setting cannot slip through.
- Tabs: YAML forbids tab characters in indentation. Each line that starts with a tab is listed.
- Multiple documents: files with several documents separated by
---, as in Kubernetes manifests, are validated document by document and shown as a JSON array. - Custom tags: CloudFormation tags such as
!Ref,!Suband!GetAttare rejected by standard parsers. Tick “Accept custom tags” and they are read as{"!Ref": "MyBucket"}in the JSON and kept as tags in the normalized YAML.
YAML 1.2 core schema pitfalls
YAML 1.2 (2009) simplified how unquoted values are typed, but many tools still follow YAML 1.1, including PyYAML and older Ruby and Go libraries. The same file can therefore produce different data. The validator uses the YAML 1.2 core schema and warns about these values:
| Unquoted value | YAML 1.1 | YAML 1.2 core | Safe form |
|---|---|---|---|
yes, no, on, off, NO | Boolean | String | "no" or false |
0644 | Octal 420 | Decimal 644 | "0644" or 0o644 |
2024-01-15 | Timestamp | String | "2024-01-15" |
22:22 | Base 60: 1342 | String | "22:22" |
1.10 | Float 1.1 | Float 1.1 | "1.10" |
~, null, empty | Null | Null | "" for an empty string |
The famous example is the “Norway problem”: the country code NO becomes false in YAML 1.1. Another is the on: key of GitHub Actions workflows, which PyYAML reads as true. Quoting the value always removes the ambiguity.
Common YAML errors
bad indentation of a mapping entry: a key is indented differently from its siblings, or an unquoted value contains:. Align the keys or quote the value.end of the stream or a document separator is expected: content continues at an indentation the parser cannot attach, for example a list item followed by a key at the same level.duplicated mapping key: the same key appears twice in one mapping.can not read a block mapping entry; a multiline key may not be an implicit key: usually a line without a colon, or a colon without a space after it.
Tips
- Set your editor to insert spaces for the Tab key in YAML files.
- Quote strings that look like numbers, booleans, dates or times; quoting never hurts.
- The normalized YAML view shows how anchors and merge keys (
<<: *defaults) expand. - Need to convert rather than check? The JSON to YAML converter turns YAML into JSON and back. For JSON files use the JSON validator, and for TOML the TOML to JSON converter.
Frequently Asked Questions
Common questions about validating YAML.
Paste the YAML or open the file. A “Valid YAML” badge means it parses; otherwise you see the line, column, reason and a code frame pointing to the problem.
Indentation defines structure in YAML, and tab widths differ between editors, so the specification only allows spaces for indentation. Tabs are still allowed inside quoted strings and inside the text of block scalars.
The YAML specification requires unique keys in a mapping. Some parsers accept duplicates and keep the last value, which can silently override a setting, so the validator reports it.
In YAML 1.1 these unquoted words are booleans; in YAML 1.2 they are strings. Tools disagree, so quote them to make the meaning explicit.
It uses js-yaml 4, which implements YAML 1.2. The default setting is the 1.2 core schema with merge keys; the js-yaml default schema adds timestamps, binary, sets and ordered maps.
Yes, it checks their YAML syntax, including files with several documents separated by ---, but not their field names.
Yes. Tick “Accept custom tags” and short-form tags such as !Ref, !Sub and !GetAtt are accepted and shown as objects in the JSON view.
No. The js-yaml library is loaded from a CDN once, and all parsing happens in your browser.