About the YAML validator
YAML relies on indentation, so a single misplaced space or a tab can break a Kubernetes manifest, a Docker Compose file or a CI workflow, often with a confusing error at deploy time.
This validator checks your YAML and reports each problem with its line and column. When the YAML is valid, it shows how the parser reads it as JSON, so you can spot surprises such as a value parsed as a number or null.
How to use the YAML validator
- Paste your YAML into the editor, open a .yaml or .yml file, or click Load sample.
- Choose whether to see the result as JSON or as formatted YAML.
- Click Validate YAML or press Ctrl + Enter (Cmd + Enter on Mac).
- If there's an error, go to the line and column shown, fix it, and validate again.
Examples
Catch bad indentation
Input
services:
web:
image: nginx
ports:
- "80:80"Output
Line 4, column 1: All mapping items must start at the same columnports is indented by 3 spaces instead of 4, so it doesn't line up with image.
Catch duplicate keys
Input
name: api
replicas: 2
name: workerOutput
Line 3, column 1: Map keys must be uniqueCommon errors and how to fix them
Tabs are not allowed as indentation
YAML only allows spaces for indentation. Replace the tabs with spaces; most editors can do this with a Convert indentation to spaces command.
Nested mappings are not allowed in compact mappings
A value contains : (a colon followed by a space), like title: Note: read me. Quote the value: title: "Note: read me".
did not find expected key
A line's indentation doesn't match its siblings, or a list item - is misaligned. Make sure keys at the same level start in the same column.
Good to know
- It parses YAML 1.2 and reports syntax errors such as wrong indentation, tabs used for indentation, unclosed brackets or quotes, and duplicate keys.
- Files with several documents separated by
---are supported; the JSON result is then an array with one entry per document. - Custom tags such as CloudFormation's
!Refor!Subare reported as warnings, not errors, because they're valid YAML that only some tools understand. - Anchors and aliases (
&nameand*name) are supported, with a limit that blocks "billion laughs" files designed to expand into huge amounts of data. - It checks syntax, not meaning. A file can be valid YAML and still be rejected by Kubernetes or GitHub Actions if a field name or value is wrong for that tool.
Frequently asked questions
Why are tabs not allowed?
The YAML specification forbids tabs for indentation, because tab width differs between editors and would make the structure ambiguous. Use spaces; most editors can convert tabs to spaces automatically.
Why did my value turn into true or a number?
Unquoted values are interpreted: true, 42 and 1.5 become a boolean and numbers. Older YAML 1.1 parsers also read yes, no, on and off as booleans. Put a value in quotes, like "no", to keep it a string.
Can it validate a Kubernetes or Docker Compose file?
It checks that the file is valid YAML, which catches most indentation and syntax mistakes. Checking field names against the Kubernetes or Compose schema needs a dedicated tool such as kubectl --dry-run or docker compose config.