YAML Validator
Checks YAML as you type. Syntax errors point to the exact line and column with a hint, and warnings flag valid YAML that different tools read differently, such as NO, on, 0755 or 3.10.
- Runs in your browser
- Nothing uploaded
- Free, no sign-up
How to Use YAML Validator
- Paste your YAML or open a .yaml or .yml file. Click Sample to see a file with typical problems.
- Read the status line: valid, valid with warnings, or invalid with the line and column.
- For an error, look at the marked line and the hint under it. For warnings, each entry starts with its line number.
- Choose whether the parsed data is shown as JSON or as formatted YAML, then copy or download it.
Example: a workflow file that parses but hides four problems
The Sample button loads a GitHub Actions style workflow. It is valid YAML, so most validators would just say “valid”. This one also reads it the way older tools do:
# GitHub Actions style workflow
name: deploy
on:
push:
branches: [main]
env:
REGION: eu-west-1
COUNTRY: NO
NODE_VERSION: 20.10
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes:
steps:
- uses: actions/checkout@v4
- name: Install
run: |
npm ci
npm test
- uses:actions/cache@v4
- name: Deploy
run: ./deploy.sh
The result is Valid YAML: 1 document, 18 keys, depth 5, with 4 warnings. The warnings are:
- Line 3: The key on is read as true by YAML 1.1 readers such as PyYAML. Quote it ("on") if other tools read this file.
- Line 8: The value NO (key COUNTRY) is text in YAML 1.2 but false in YAML 1.1 (PyYAML and other older readers). Quote it ("NO") to keep it text, or write false.
- Line 9: The value 20.10 (key NODE_VERSION) is read as the number 20.1, so the trailing zero is lost. If it is a version number, quote it ("20.10").
- Line 20: The line uses:actions/cache@v4 is read as one piece of text, not as a key and value, because there is no space after the colon. Write uses: actions/cache@v4 if you meant a key.
And the notes:
- Line 13: The key timeout-minutes has no value, so it is read as null. If you meant an empty text, write timeout-minutes: "".
- Line 22: Trailing spaces at the end of the line.
Each of these is a common source of bugs. A Python script that reads the workflow with PyYAML sees the key on as True. A YAML reader turns NODE_VERSION: 20.10 into the number 20.1. The step uses:actions/cache@v4 is a plain string rather than a uses key, so whatever reads the workflow never sees the action.
Common YAML errors and what the validator says
Every message below is the tool’s own output for the example in that row. The first seven rows are syntax errors; the rest are valid YAML that gets a warning.
| Problem | Example | What the validator reports | Fix |
|---|---|---|---|
| Tab used for indentation | server: |
Invalid YAML: line 2, column 1: Tab characters must not be used in indentation. | Replace the tab with spaces. |
| Line indented one space too far | server: |
Invalid YAML: line 3, column 8: Bad indentation of a mapping entry. | Line up port with host. |
| Same key twice | name: api |
Invalid YAML: line 2, column 1: Duplicated mapping key. | Remove or rename one of the keys. |
| Quote never closed | title: "Release notes |
Invalid YAML: line 1, column 22: Unexpected end of the stream within a double quoted scalar. | Add the closing quote. |
| List not closed | tags: [web, api |
Invalid YAML: line 1, column 16: Unexpected end of the stream within a flow collection. | Add the closing ]. |
| Item not lined up with its list | steps: |
Invalid YAML: line 3, column 2: Bad indentation of a mapping entry. | Indent – test like – build. |
| Alias with no anchor | base: *defaults |
Invalid YAML: line 1, column 16: Unidentified alias "defaults". | Define &defaults above it. |
| No space after the colon | name:api |
The line name:api is read as one piece of text, not as a key and value, because there is no space after the colon. Write name: api if you meant a key. | Write name: api. |
| Norway problem | country: NO |
The value NO (key country) is text in YAML 1.2 but false in YAML 1.1 (PyYAML and other older readers). Quote it ("NO") to keep it text, or write false. | Write country: “NO”. |
| Version number | python: 3.10 |
The value 3.10 (key python) is read as the number 3.1, so the trailing zero is lost. If it is a version number, quote it ("3.10"). | Write python: “3.10”. |
| Leading zero | zip: 02134 |
The value 02134 (key zip) is the number 2134 in YAML 1.2 (the leading zero is dropped) but the octal number 1116 in YAML 1.1. Quote it if it is a code, zip code or ID. | Write zip: “02134”. |
| Time of day | backup: 3:30 |
The value 3:30 (key backup) is text in YAML 1.2 but the base-60 number 210 in YAML 1.1. Quote it if it is a time such as "3:30". | Write backup: “3:30”. |
How it works
- The text is parsed by js-yaml 4.1.0 (MIT license), which is bundled into the page and follows the YAML 1.2 spec. A parse error gives the line and column, the line itself with a marker, and a hint written for people.
- If parsing succeeds, a second pass reads each line for values that YAML 1.1 readers such as PyYAML treat differently: yes, no, on and off, numbers with a leading zero, and times such as 3:30 that 1.1 reads as base-60 numbers.
- It also flags version numbers that lose a trailing zero,
key:valuelines with no space after the colon, keys with no value, unused anchors, mixed indent steps and trailing spaces. - Text inside
|and>blocks, quoted values and comments is skipped, so a shell script in arun: |block does not produce false alarms. - Custom tags such as
!Refare allowed by default, since they are valid YAML. Set them to “Report as errors” if your reader does not know them.
Limits
- It checks YAML syntax, not a schema. It cannot tell you that a Kubernetes field name is misspelled or that a value has the wrong type for your app.
- The warnings come from reading each line. Long values that run over several lines without quotes, or flow mappings in braces, are not checked for YAML 1.1 differences.
- Only the first syntax error in a file is shown. Once it is fixed, the check runs again and reports the next one.
Frequently asked questions
Is my YAML valid if this tool says so?
It is valid YAML 1.2, which is what current libraries in most languages read. Read the warnings too: they show places where the file is valid but an older YAML 1.1 reader would see different data.
Why does YAML not allow tabs?
The YAML spec forbids tabs for indentation because editors show them at different widths, which would make the nesting ambiguous. Tabs inside quoted text are fine. Replace the tab at the start of the line with spaces.
What does “bad indentation of a mapping entry” mean?
A key is indented by a different number of spaces than the keys around it, so the parser cannot tell which mapping it belongs to. Line it up with its siblings, or indent it further if it should belong to the key above.
Can I convert the YAML to JSON after checking it?
Set “Show result as” to JSON and copy the result, or use the YAML to JSON converter, which also handles several documents, CloudFormation tags and dates.
Related Tools
Convert CSV to YAML →
Convert CSV to YAML with smart type detection, multi-line block scalars, reserved-word quoting (no…
JSON to YAML Converter →
Turns JSON into clean, readable YAML. Strings that YAML would misread, such as NO,…
XML to YAML Converter →
Convert XML into readable YAML that mirrors the document tree, with indentation for nesting.
YAML to CSV Converter →
Convert a YAML list of items into CSV, with keys as columns and values…
YAML to JSON Converter →
Converts YAML to JSON with anchors, aliases and
YAML to TOML Converter →
Convert a YAML mapping into TOML, with nested mappings as tables and lists as…
Twitter Card Validator →
Check your Twitter Card markup against the rules and see a clear pass, warning,…
XML Sitemap Validator →
Check your sitemap XML against the protocol, with a well-formed check, URL and priority…
YAML to XML Converter →
Convert YAML with nested mappings and lists into clean, nested XML.
Base64 to PDF Decoder And Viewer →
Decodes Base64 or a data:application/pdf URI into a PDF you can preview and download,…
Compress PDF →
Optimize and shrink a PDF in your browser by re-saving it efficiently and stripping…
Crop PDF →
Trim the margins off every page of a PDF by a percentage and download…