YAML Validator
Paste YAML to check whether it is valid. If it isn't, see exactly which line and column broke. Everything runs locally in your browser.
Your YAML is validated in this browser and is not sent to Docspira. Learn more.
What this checks
This tool checks whether your YAML is syntactically valid using a YAML 1.2 parser: the same engine Docspira's YAML ↔ JSON converter uses. It reports the line and column of the first error, supports multi-document YAML (separated by "---"), and understands anchors, aliases, merge keys, and block scalars. It does not validate Kubernetes, Docker Compose, or GitHub Actions schemas, and it is not a linter or a formatter; it only checks syntax.
What this tool does
Check YAML syntax before committing a configuration file.
Valid YAML vs. correct configuration
It checks that your document is syntactically valid YAML: indentation is consistent, mappings and lists are well formed, quotes and block scalars are closed, keys are unique, and aliases point to anchors that exist.
It does not check that the YAML is the right configuration for your application. A Kubernetes manifest with replicas: "three" is perfectly valid YAML and still a broken deployment. To check structure and types, convert it with the YAML to JSON converter and validate the result against a schema in the JSON Schema validator.
The 8 YAML errors people actually hit
Every example below was run through two JavaScript parsers (js-yaml and eemeli/yaml). The error text you see in your own tool may be worded differently, but the cause is the same.
| You wrote | What goes wrong | Fix |
|---|---|---|
A tab before host: |
YAML forbids tab characters in indentation. Parsers report "tab characters must not be used in indentation". | Replace tabs with spaces. Set your editor to insert spaces in .yml files. |
host: a then port: 80 (one extra space) |
Sibling keys must start at exactly the same column. Reported as "bad indentation of a mapping entry". | Align every key at the same level to the same column. |
title: Error: not found |
A second : inside an unquoted value looks like a nested mapping. |
Quote the value: title: "Error: not found". |
path: *.log |
* starts an alias, so the parser looks for an anchor named .log and fails with "unidentified alias". |
Quote it: path: "*.log". Same for values starting with &. |
user: @admin |
@ and ` are reserved and cannot start a plain value. |
Quote it: user: "@admin". |
a: 1 then a: 2 |
Duplicate keys. Strict parsers reject it; some lenient ones silently keep the last value (PyYAML returns {'a': 2}). |
Remove the duplicate. Don't rely on "last one wins". |
A list item followed by b: c at the list's indentation |
Mixing a sequence and a mapping at the same level. | Either indent b: c under a list item or make every entry a list item. |
color: #fff |
# after a space starts a comment, so the value becomes empty (null). No error is raised, which makes this one sneaky. |
Quote it: color: "#fff". |
Same file, different answers: YAML 1.1 vs YAML 1.2
This is the trap that no syntax error will warn you about. The file below is valid everywhere, but parsers disagree on what it means:
country: NO
enabled: yes
port: 08
time: 12:30
version: 1.10
| Key | YAML 1.2 parsers (this validator, js-yaml, eemeli/yaml) | YAML 1.1 parsers (PyYAML, older Ruby/Go libs) |
|---|---|---|
country: NO |
the string "NO" |
false (the "Norway problem") |
enabled: yes |
the string "yes" |
true |
port: 08 |
the number 8 |
the string "08" |
time: 12:30 |
the string "12:30" |
the number 750 (read as base-60: 12×60+30) |
version: 1.10 |
the number 1.1 |
the number 1.1 |
We ran this exact file through js-yaml, eemeli/yaml and PyYAML 6 to build the table. The practical rule: quote anything that is meant to be a string but looks like a boolean, number, time or version. version: "1.10" is the only way to keep the trailing zero in every parser.
Quick YAML syntax reminders
- Indentation is spaces only. Two spaces is the convention; any consistent number works.
key: valueneeds a space after the colon.key:valueis a single string.- Lists:
- item. A list of objects:- name: awith the next key aligned undername. - Multi-line text:
|keeps line breaks,>folds them into spaces. Add-(|-) to drop the final newline. - Comments start with
#after whitespace. There are no block comments. - A file can hold several documents separated by
---.
FAQ
Is this YAML validator safe for secrets and internal configs?
Yes. Parsing happens in your browser with JavaScript. Your YAML is not uploaded, logged or stored. You can confirm it in your browser's developer tools: the Network tab shows no request when you validate.
Does it validate YAML against a schema?
No, it checks syntax only. For structure and types, convert the YAML to JSON with the YAML to JSON converter and validate it in the JSON Schema validator.
Which YAML version does it follow?
YAML 1.2, the current spec. That means yes, no, on and off are strings, not booleans. If the file will be read by a YAML 1.1 parser (PyYAML, for example), quote those values to be safe.
Why does my YAML say valid but my app still fails?
Valid YAML only means it parses. Common causes: a value you expected as a string parsed as a number or boolean (see the 1.1 vs 1.2 table above), a key misspelled, or a key at the wrong indentation level so it belongs to a different parent.
What's the difference between .yml and .yaml?
None. Both extensions are the same format. .yaml is the officially recommended one; .yml is common for historical reasons (Docker Compose, GitHub Actions accept both).
Can I check a file with multiple documents (---)?
Yes, the validator reads multi-document streams and reports the location of the first error it finds.
Before you start
A valid YAML document can still be the wrong application configuration; this tool checks parsing, not your product's schema.
Privacy
This tool runs in your browser; the text or file you choose is not uploaded for processing. Read the privacy details.