Config tool
YAML Validator
Validate YAML, convert YAML to JSON, or JSON to YAML. Errors include line and column numbers. Free and client-side.
Input — paste your YAML
How YAML Validation Works
YAML (YAML Ain't Markup Language) is a human-readable data serialization format widely used for configuration files — Docker Compose, Kubernetes manifests, GitHub Actions workflows, Ansible playbooks, and most CI/CD pipeline definitions use YAML. Its readability comes at a cost: YAML is notoriously sensitive to indentation, and small mistakes produce cryptic errors or silently incorrect data.
This validator uses the js-yaml parser — the same library used by most Node.js tooling — to check your YAML against the 1.2 specification. Errors include the exact line and column number so you can find the problem immediately without counting spaces. The tool also offers Format mode to normalize indentation, and JSON conversion for when you need the data in a different format.
The Most Common YAML Errors
Indentation errors are by far the most common. YAML uses spaces only — tabs are
forbidden and will cause an immediate parse failure. Inconsistent indentation within
the same block also fails. The second most common error is unquoted special characters:
colons followed by spaces (: ) are value separators, so a string like
url: http://example.com fails because the second colon is interpreted as
a second key-value separator. Wrap such values in quotes.
Common error — unquoted URL (fails)
url: http://example.com:8080/path # ❌ second colon breaks parsing
Fixed — quoted string (valid)
url: "http://example.com:8080/path" # ✓ quotes protect the colon
YAML vs JSON — When to Use Each
YAML is a superset of JSON — all valid JSON is also valid YAML. Use YAML for configuration files that humans write and maintain: it supports comments, multi-line strings, and anchors for reuse. Use JSON for data exchange between systems: it is simpler to parse, unambiguous, and universally supported. Use the JSON conversion mode in this tool to convert YAML config to JSON for APIs or tooling that requires it. Once you have JSON output, our JSON Formatter can beautify and validate it further.
Frequently Asked Questions
- Why does YAML not allow tabs for indentation?
- The YAML specification explicitly forbids tab characters for indentation because different editors and tools render tabs as different numbers of spaces (2, 4, or 8), making the same file appear differently indented in different environments. Only spaces are allowed. Most code editors can be configured to insert spaces when you press Tab — in VS Code, set "Editor: Insert Spaces" to true and choose your indentation size. If your YAML is failing with a tab error, use a find-and-replace to convert all leading tabs to spaces.
- Why is my colon causing a YAML parse error?
-
In YAML, a colon followed by a space (
:) is a key-value separator. If your value contains a colon followed by a space — like a URL with a port number (http://host:8080/path) or a timestamp (12:30:00) — the parser treats it as a nested structure. The fix is to wrap the value in single or double quotes:url: "http://host:8080/path". The same applies to values starting with special characters like{,[,#,|, or>. - What is the difference between single and double quotes in YAML?
-
Single-quoted strings are literal — no escape sequences are processed.
The only special sequence is
''(two single quotes) which represents a single quote character. Double-quoted strings support escape sequences like\n(newline),\t(tab), and\uXXXX(Unicode). Use single quotes when your string contains backslashes or should be treated completely literally. Use double quotes when you need escape sequences or when the string contains single quotes. - What are YAML anchors and aliases?
-
Anchors (
&name) and aliases (*name) allow you to reuse values across a YAML document without repetition. Define a value once with an anchor, then reference it with an alias wherever you need the same value. This is particularly useful in CI/CD configurations where the same environment variables or build steps appear in multiple jobs. This validator supports anchor and alias syntax — if they parse correctly, the output will show the resolved values. - What is the difference between block style and flow style in YAML?
-
Block style uses indentation to define structure — each item on its own line.
Flow style uses
{}for objects and[]for lists, similar to JSON syntax. Both are valid YAML. Block style is more readable for humans and preferred in configuration files. Flow style is more compact and useful for short inline collections. This validator accepts both. The Format mode normalizes output to block style. - Why does YAML sometimes interpret values as unexpected types?
-
YAML 1.1 (used by many older parsers) interprets certain unquoted values as
booleans:
yes,no,on,off,true,falseall become boolean values. Country codes likeNO(Norway) or version numbers like1.0can also be misinterpreted. YAML 1.2 (used by this tool) is stricter and only treatstrueandfalseas booleans. If you see unexpected type conversions, quote the value:status: "yes".