YAML Validator & Linter — Find Errors and Hidden Pitfalls
Validate YAML with the exact line and column of each error, and catch the mistakes parsers accept silently: yes/no booleans, tabs, duplicate keys.
services:
web:
image: nginx:1.27
ports:
- '8080:80'
- '22:22'
environment:
COUNTRY: 'NO'
DEBUG: 'yes'
APP_VERSION: 1.1
db:
image: postgres:16
restart: unless-stopped
Duplicate keys: shown with the last value winning, which is what many parsers silently do. The formatted view is rebuilt from the parsed data, so comments and anchors are not kept. Fix issues in your original file.
Runs entirely in your browser. Your YAML is never uploaded, so secrets in config files stay on your machine. Browse all free tools.
Found a problem, or something that could be better? We read every message and we fix things quickly.
This free YAML validator checks a YAML file for syntax errors and shows the exact line and column, with the surrounding lines and a caret under the problem. Paste a Kubernetes manifest, a docker-compose.yml, a GitHub Actions workflow or an OpenAPI spec and you know in a second whether it parses, and if not, where it breaks.
A parser accepting your file is not the same as your file meaning what you think. The linter also flags values that YAML 1.1 parsers (PyYAML, SnakeYAML, Go yaml.v2) read differently from YAML 1.2: NO becomes false, 0755 becomes 493, 22:22 becomes 1342, and 1.10 becomes 1.1. It lists every duplicate key with both line numbers, tabs in indentation, and "key:value" written without a space. It checks syntax and these pitfalls; it does not validate against a schema such as the Kubernetes API.
How to use
- Paste your YAML into the editor. A docker-compose example with a few deliberate mistakes is loaded to show what gets flagged.
- Read the status bar: green means valid, red shows the error with its line and column, and the lines around it.
- Click any item in the lint list to jump to that line in the editor and fix it.
- Switch between the formatted YAML and JSON views to check how the file was actually parsed: this is where yes/no or 0755 surprises become obvious.
- Copy or download the formatted output if you need it, and keep fixing the original file so comments are preserved.
Frequently asked questions
What is the YAML Norway problem?
In YAML 1.1, the unquoted words y, yes, n, no, on and off (in any common capitalisation) are booleans. So a list of country codes containing NO for Norway gives you false instead of the string "NO". YAML 1.2 (2009) fixed this: only true and false are booleans. Many widely used parsers still follow 1.1, including PyYAML, Ruby's Psych, Java's SnakeYAML and Go's yaml.v2, so the safe fix is to quote such values: "NO", "yes", "on".
Why are tabs not allowed in YAML?
The YAML specification forbids tabs for indentation because their width is not defined, and indentation is how YAML expresses structure. Tabs are allowed inside values and comments, just not in the leading whitespace of a line. Configure your editor to insert spaces for .yml and .yaml files; two spaces per level is the most common convention.
Are duplicate keys allowed in YAML?
No. The YAML spec requires keys in a mapping to be unique, but parsers disagree on what to do about it: some raise an error (as this validator does), while others silently keep the last value. That makes duplicates dangerous: in a long manifest you can edit the first occurrence and see no effect. This tool lists every duplicate with the line where the key was first defined.
Why does my YAML say "bad indentation of a mapping entry"?
Either the line is indented differently from the other keys at the same level, or a value contains a colon followed by a space and needs quotes. For example, title: Note: read this fails because the parser sees a second key. Write title: "Note: read this". Check the line shown and the one above it; the error often starts on the previous line.
Is YAML a superset of JSON?
YAML 1.2 was designed so that valid JSON is also valid YAML, and in practice any JSON document parses here. The reverse is not true: YAML adds comments, anchors and aliases, multi-line strings and multiple documents per file. Use the JSON view to see how a YAML file maps onto plain JSON data.
Does this validate Kubernetes or GitHub Actions schemas?
No. It checks YAML syntax and the pitfalls above, which cause most real failures, but it does not know which keys a Kubernetes Deployment or a GitHub workflow allows. For schema validation use kubectl apply --dry-run=server, kubeconform, or the YAML extension for VS Code with the matching JSON Schema.
YAML 1.1 vs YAML 1.2: values that change meaning
This validator parses with YAML 1.2 rules (js-yaml). If your file is read by a YAML 1.1 parser, these unquoted values mean something else, and the linter warns about each one:
• yes, no, on, off, y, n → booleans in 1.1, strings in 1.2. GitHub Actions workflows start with on:, which a 1.1 parser reads as the key true.
• 0755 → octal 493 in 1.1, decimal 755 in 1.2. File modes and ZIP codes with a leading zero both suffer.
• 22:22 → 1342 in 1.1 (base 60), the string "22:22" in 1.2. Docker’s Compose documentation recommends quoting port mappings for exactly this reason.
• 1.10 → the number 1.1 in both versions. Quote version numbers.
• 2024-01-05 → a timestamp in most parsers, not a string.
The rule that avoids all of them: quote any value that is meant to be text but looks like something else.
Common YAML errors and their fixes
• "bad indentation of a mapping entry": inconsistent indentation, or an unquoted value containing ": ".
• "end of the stream or a document separator is expected": usually a line indented less than its siblings, or text after a closing quote.
• "can not read a block mapping entry; a multiline key may not be an implicit key": often a missing colon on the line before, or a quote opened and not closed.
• "unexpected end of the stream within a double quoted scalar": an unclosed " somewhere above the reported line.
• Values starting with @, `, *, &, !, | or > have special meaning or are reserved. Quote them.
• A # preceded by a space starts a comment, so password: abc #123 stores abc. Quote values that contain " #".
Related free tools
- JSON Formatter — Pretty-print, minify and validate JSON, with parse errors located by line and column. In your browser, no upload.
- JSON to TypeScript — Paste a JSON sample and get TypeScript interfaces, a Zod schema, JSON Schema or types for Go, Python, Java, C#, Kotlin, Swift and Rust.
- SQL Formatter — Format messy SQL into readable, consistently indented queries for PostgreSQL, MySQL, T-SQL, BigQuery and more. Runs in your browser.
- Regex Tester — Test a regular expression against sample text with live match highlighting, capture groups and replace preview. Free, in your browser.
- Diff Checker — Compare two versions of a text, code or JSON file and see exactly which lines, words and characters changed.