YAML Validator
Validate, format, and convert YAML to JSON. Syntax errors reported with exact line and column numbers.
Cmd/Ctrl+Enter to validate
Validation result will appear here
What Is YAML?
YAML (YAML Ain't Markup Language) is a human-readable data serialization format widely used for configuration files — Docker Compose, Kubernetes manifests, GitHub Actions, Ansible playbooks, and more. YAML is whitespace-sensitive, making syntax errors easy to introduce and hard to spot. This validator parses your YAML with the js-yaml library, reports errors with exact line and column numbers, and formats the result.
How to Use
- Paste your YAML in the input area and click Validate (or Cmd/Ctrl+Enter)
- If valid: see the formatted YAML and the equivalent JSON representation
- If invalid: see the error message with line and column number highlighted
- Use Load Valid Sample or Load Invalid Sample to explore examples
Common YAML Mistakes
- Inconsistent indentation: YAML requires spaces, not tabs, and consistent nesting
- Missing quotes on special values:
yes,no,true,false,null, and numbers are auto-typed — quote them to force strings - Colon in unquoted value:
url: http://example.com— the second colon breaks parsing; quote the value - Duplicate keys: YAML technically allows duplicate keys but behavior is undefined; most parsers keep the last value
- Tab characters: YAML forbids tabs as indentation — use spaces only
FAQ
What is the difference between YAML and JSON?
YAML is a superset of JSON — any valid JSON is valid YAML. YAML adds comments (# ...), multi-line strings, anchors/aliases (& / *), and more human-friendly syntax. JSON is better for machine-to-machine communication; YAML is preferred for config files read by humans.
What does the formatter do to my YAML?
The formatter parses your YAML into a JavaScript object and then re-serializes it with consistent 2-space indentation. This normalizes quoting, ordering of map keys (alphabetical), and removes redundant anchors. Comments are stripped since they are not part of the data model.
Why does my boolean value break things?
YAML 1.1 (used by many tools) treats yes, no, on,off as booleans in addition to true/false. YAML 1.2 only treats true/false as booleans. If you need a literal string, always quote it: "yes".