Validate YAML Online: Find Errors by Line Number in Seconds
YAML errors are invisible until they blow up your CI pipeline. This guide shows you how to validate YAML online with exact line numbers - and the five mistakes that cause most failures.
YAML looks simple. Until it isn't.
You write a GitHub Actions workflow, push it, and twenty minutes later you're reading a red-faced error that says Invalid YAML with no line number. Or you ship a Docker Compose file to production and the container refuses to start because of a tab character you didn't know was there.
The problem isn't YAML's complexity - it's that most tools tell you something is wrong without telling you where. This guide fixes that.
Why Line Numbers Matter in YAML Errors
Most YAML validators tell you the error is somewhere near "line 12." Some don't even do that. They just fail silently or throw a wall of JSON-schema jargon that doesn't help you fix the actual file.
A validator that reports exact line and column numbers turns a 20-minute debugging session into a 10-second fix. You scroll to line 47, look at the indentation, and the problem is right there.
Toolblip's YAML Validator does exactly this - it parses your YAML, reports every error with its precise location, and highlights the problematic character so you don't have to guess.
The Five YAML Mistakes That Cause Most Failures
Before we get to the validator, let's map the five mistakes that account for the vast majority of real-world YAML failures. Knowing what to look for makes the line numbers meaningful.
1. Tabs Instead of Spaces
YAML requires spaces for indentation. Not tabs. Not "tabs if your editor looks right." Tabs will silently fail in some parsers and error in others.
# โ Wrong - tab character on the second line
name: Toolblip
version: "1.0"
# โ
Correct - two spaces
name: Toolblip
version: "1.0"
If you didn't know this, you're not alone - it's the single most common YAML mistake that developers hit when they first work with Docker Compose or Kubernetes manifests.
Fix: Set your editor to "insert spaces" and configure the tab size to 2. Most modern editors (VS Code, Sublime, JetBrains) can do this per-language.
2. Accidental Type Coercion
YAML automatically converts unquoted strings that look like booleans or numbers. This is handy until it isn't.
# โ "yes" and "no" become true/false booleans
ssl_enabled: yes
debug: no
# โ
Quoted strings stay as strings
ssl_enabled: "yes"
debug: "no"
The same applies to values that look like floats vs integers, and ISO timestamps:
# โ ๏ธ YAML interprets these
cost: 19.99 # โ float (might cause issues in strict type systems)
version: "1.0" # โ string (correct)
started: 2026-04-23 # โ date object in some parsers
When in doubt, quote strings. It makes your intent explicit and avoids surprises when your YAML gets parsed by a different system than you expected.
3. Mixing List and Map Syntax
YAML has two ways to write a list of objects - the block style (with -) and the flow style (with []). Mixing them incorrectly produces confusing errors.
# โ Block item mixed with flow map
tools:
- name: JSON Formatter
type: [formatter, utility] # flow list inside block item - valid but confusing
- name: Regex Tester
type: [formatter, utility]
# โ
Block all the way - easier to read and diff
tools:
- name: JSON Formatter
type:
- formatter
- utility
4. Duplicate Keys
Most YAML parsers silently accept duplicate keys and use the last one - which means bugs that only manifest in specific deployment environments.
# โ Duplicate key - last value wins silently
name: Toolblip
version: "1.0"
name: Toolblip Pro # This overwrites the first "name" - no warning!
# โ
Unique keys
name: Toolblip Pro
version: "1.0"
This one is particularly insidious in GitHub Actions where you might copy-paste a name: field from a template and forget to change both.
5. Unquoted Colons and Special Characters
Colons in YAML must be surrounded by whitespace or quoted, otherwise they're parsed as mapping separators.
# โ Unquoted colon - parsed as "key: value" mapping
url: https://api.toolblip.com:8080/path
# โ
Quotes protect the colon
url: "https://api.toolblip.com:8080/path"
The same applies to pipes (|), greater-thans (>), and other YAML-specific characters:
# โ The > is interpreted as folded block scalar
description: Tools > Workflows > Results
# โ
Quoted
description: "Tools > Workflows > Results"
How to Validate YAML Online with Line Numbers
Here's how to use Toolblip's YAML Validator to find and fix errors fast.
Step 1: Paste Your YAML
Open toolblip.com/tools/yaml-validator. Paste your YAML content. The validator runs entirely in your browser - no data is sent to any server.
Step 2: Read the Error Report
If your YAML is valid, you'll see a green success message instantly. If there are errors, each one is listed with:
- Line number (1-indexed, matching what your editor shows)
- Column number (the character position within that line)
- A plain-English description of what went wrong
Line 12, Col 3: Tab character detected. YAML requires spaces for indentation.
Line 24, Col 8: Duplicate key "name" - last occurrence wins.
Line 31, Col 1: Unexpected token. Did you forget a dash or closing bracket?
Step 3: Click to Jump
In browsers that support it, error messages are linked to their line. Click the line number and your browser's Find feature will jump to that position. Or just scroll - line numbers are visible in the editor panel.
Step 4: Fix and Re-validate
Make your change, re-paste if needed, and confirm the green checkmark. For fast iteration, keep the validator open in a side tab.
Real-World YAML Validation Scenarios
GitHub Actions Workflows
GitHub Actions YAML is notoriously unforgiving. A missing space after a colon, a tab character that crept in from a copy-paste, an incorrect on: trigger - all of these fail silently until you push.
# โ Missing space after colon - GitHub Actions won't trigger
on:push
branches: [main]
# โ
Correct
on: push
branches: [main]
The YAML Validator catches the space issue instantly and shows you the exact line.
Docker Compose Files
Docker Compose files have their own gotchas - notably around ports vs expose, and the difference between string and integer values in the ports mapping.
# โ Ports as unquoted strings - sometimes works, sometimes doesn't
ports:
- "8080:80" # string - correct
- 8081:80 # unquoted integer - works in Compose v1, fails in v2
# โ
Consistent quoting
ports:
- "8080:80"
- "8081:80"
Kubernetes Manifests
Kubernetes YAML must follow the schema for each resource type. A missing spec: block, an incorrect apiVersion:, or a malformed selector label will all cause the apply to fail - but kubectl apply doesn't always give you the most helpful error messages.
Validate your manifest with the YAML Validator first to catch basic syntax errors before running kubectl apply -f.
What Good YAML Looks Like
Here's a well-formed GitHub Actions workflow - use this as a reference when you're writing from scratch:
name: Deploy to Production
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
NODE_ENV: production
API_URL: ${{ vars.API_URL }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Run tests
run: npm test
- name: Deploy
if: github.ref == 'refs/heads/main'
run: |
echo "Deploying to ${{ env.API_URL }}"
npm run deploy
Notice:
- Two-space indentation (no tabs)
- All string values that could be misinterpreted are quoted
on:has a proper nested structure- The
||block scalar is properly formatted
YAML Validator vs JSON Formatter: Different Tools, Different Jobs
If you're converting between formats, the YAML โ JSON Converter does both validation and conversion in one step. But if you specifically want to check a YAML file for errors without converting it, the YAML Validator is the right tool - it gives you line-level error reporting that the converter doesn't focus on.
For working with API data and configuration dumps, you'll also want the JSON Formatter and JSON Diff tools in your workflow.
The Short Version
Most YAML errors come from five root causes:
- Tabs instead of spaces - the most common, and most invisible
- Unquoted strings that get coerced -
yesbecomestrue - Duplicate keys - silently overwritten, hard to debug
- Unquoted colons in URLs and paths -
https://needs quotes - Mixed list/map syntax - keep it consistent
When you hit an error, don't guess. Paste your YAML into toolblip.com/tools/yaml-validator and get the exact line number. The fix takes seconds once you know where to look.
Toolblip's YAML Validator runs entirely in your browser. No data leaves your machine. Validate YAML now โ
Ready to try it yourself?
Browse Free Tools โ