Home Tools Blog About

YAML Validator

In short

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
Runs in your browser; the YAML you paste or open is not uploaded.
🛡
Private by designYour files and text stay in this tab
⚡
Runs in your browserNo waiting for a server
💧
No watermarksClean output you can use
🆓
FreeNo account needed

How to Use YAML Validator

YAML Validator · free online tool · All Tools Verse
The YAML Validator tool, as it looks in your browser.
  1. Paste your YAML or open a .yaml or .yml file. Click Sample to see a file with typical problems.
  2. Read the status line: valid, valid with warnings, or invalid with the line and column.
  3. For an error, look at the marked line and the hint under it. For warnings, each entry starts with its line number.
  4. 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:
port: 8080
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:
host: db
port: 5432
Invalid YAML: line 3, column 8: Bad indentation of a mapping entry. Line up port with host.
Same key twice name: api
name: web
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:
- build
- test
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:value lines 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 a run: | block does not produce false alarms.
  • Custom tags such as !Ref are 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.

Keep going

Related Tools

All Document tools →
Share

Embed this tool

Add this free tool to your website. Copy and paste the code: