YAML Validator & Formatter
Find YAML syntax errors by line and column, catch duplicate keys, tab indentation and values that YAML 1.1 parsers read differently, and reformat YAML with a consistent indent. Supports multi-document files.
Private by design: anything you enter is processed in your browser only. It is never uploaded to or logged on our servers. YAML is parsed locally with js-yaml. Share links contain the YAML, so do not share files with secrets.
Problems (click a row to jump to the line)
| Type | Line:col | Doc | Message |
|---|
About YAML validation
YAML is used for Docker Compose, Kubernetes manifests, GitHub Actions and GitLab CI pipelines, Ansible playbooks, OpenAPI files and countless app configs. Because indentation carries meaning, one stray tab or a misaligned line can break a deployment. This validator parses your YAML with js-yaml (YAML 1.2) and shows the exact line and column of the error with the surrounding lines. Files with several documents separated by --- are checked as a whole, and each problem shows which document it is in.
Besides hard errors it lists problems that parse but cause bugs: duplicate keys (strict parsers reject them, others silently keep the last value), tabs in indentation, trailing whitespace, and values that YAML 1.1 parsers such as PyYAML, Ansible and older Go libraries read differently: unquoted yes, no, on and off are booleans there, 0755 is octal and 22:22 is a base-60 number.
Format re-indents the YAML and turns flow collections into block style. Values are written back as they were read, comments are not kept, and repeated anchors are renamed. CloudFormation (!Ref, !Sub), GitLab CI (!reference) and Home Assistant (!include) tags are accepted and kept. To convert YAML to JSON or other formats, use the data format converter; for Kubernetes-specific checks, use the Kubernetes YAML linter.
Reference Guide
The mistakes this validator finds most often:
| Problem | Example | Fix |
|---|---|---|
| Tab used for indentation | image: nginx | Indent with spaces only (2 is the common convention) |
| Missing space after the colon | image:nginx | image: nginx (without the space it is one string) |
| Inconsistent indentation | a key indented 3 spaces under siblings at 2 | Align keys of the same mapping exactly |
| Unquoted special characters | msg: Error: failed | msg: "Error: failed"; quote values with : , #, or a leading *, &, !, @ or ` |
| Duplicate key | env: twice in one mapping | Merge the two blocks; only one value survives |
| The "Norway problem" | country: NO | country: "NO" (YAML 1.1 reads NO as false) |
| File modes as numbers | mode: 0644 | mode: "0644" or 0o644 depending on the tool |
Example input
# docker-compose.yml with a few common mistakes
services:
web:
image: nginx:1.27
ports:
- 8080:80
environment:
DEBUG: no
DEBUG: "false"
restart: unless-stopped
db:
image: postgres:16
volumes:
- db-data:/var/lib/postgresql/data
volumes:
db-data: {}
This sample loads automatically when you open the tool. Use Load Sample to bring it back.
Was this tool useful?
Thanks for your feedback!
Could not send your feedback. Please try again later.
Frequently Asked Questions
A key is indented differently from the other keys of the same mapping, or a value contains an unquoted ": " so the parser sees a second key. Align sibling keys exactly and quote values that contain a colon followed by a space. The validator highlights the line and column.
No. The YAML specification requires keys to be unique, and strict parsers reject the file. Many tools silently keep the last value instead, which hides bugs, so the validator lists every duplicate key with its line.
In YAML 1.2 they are plain strings, but YAML 1.1 parsers such as PyYAML, Ansible and older Go libraries read them as booleans, so country: NO becomes false. Numbers with a leading zero such as 0755 are octal there. Quote such values to be safe everywhere.
Yes. Documents separated by --- are checked together and each problem shows its document number. Custom tags such as !Ref and !Sub (CloudFormation), !reference (GitLab CI) and !include (Home Assistant) are accepted and kept when formatting.
Related Tools
All Validation Tools →HTML Validator
Validate HTML code and catch markup errors, unclosed tags, a...
CSS Validator
Validate CSS stylesheets online for syntax errors, unknown p...
JSON Validator & Syntax Checker Online
Validate JSON syntax online and get clear error messages wit...
Color Blindness Simulator
See an image as people with protanopia, deuteranopia, tritan...
Readability Score Checker
Get Flesch Reading Ease, Flesch-Kincaid, Gunning Fog, SMOG,...
Social Media Image Resizer
Crop or fit one image to exact Instagram, Facebook, X, Linke...