YAML Validator & Converter
YAML validation checks syntax correctness and schema compliance. Common errors: indentation (spaces only, no tabs), colons require space (key: value not key:value), quotes for special chars, duplicate keys prohibited. Structure: key-value pairs, nested objects (indent 2 spaces), arrays (- item), multiline strings (| or >). Example valid YAML: name: John, age: 30, skills: [Python, JS]. Invalid: mixing tabs/spaces, key:value (no space), duplicate name keys. Use YAML for Docker Compose, Kubernetes configs, CI/CD pipelines (GitHub Actions), Ansible. Validators: yamllint, VS Code extensions.
Validate, format, and convert YAML online. Check YAML syntax with line/column error locations. Convert between YAML and JSON. Syntax highlighting included.
Works OfflineDark ModeNo Ads
YAML Input
1 lines, 0 chars
Keyboard Shortcuts
- ⌘/Ctrl + Enter — Process
- Esc — Reset
How to Use
- Enter your value in the input field
- Click the Calculate/Convert button
- Copy the result to your clipboard
Frequently Asked Questions
- What is YAML?
- YAML (YAML Ain't Markup Language) is a human-readable data serialization format. YAML uses indentation (spaces, not tabs) to represent structure, making it more readable than JSON or XML. YAML is popular for configuration files (Kubernetes, Docker Compose, Ansible, GitHub Actions), API responses, and data storage. Key features: no quotes needed for strings, supports comments (#), and allows multi-line strings.
- What is the difference between YAML and JSON?
- YAML is a superset of JSON—all valid JSON is valid YAML. YAML uses indentation instead of brackets/braces, allows comments (JSON does not), supports multi-line strings, omits quotes for most strings, and uses colons and hyphens for structure. YAML is more human-friendly for configs. JSON is simpler, faster to parse, and safer for untrusted input. Convert between them using this tool.
- How do I fix "bad indentation" YAML errors?
- YAML requires consistent indentation with spaces (not tabs). Each nested level should be indented by 2 or 4 spaces. Common errors: mixing tabs and spaces (use only spaces), inconsistent indentation (2 spaces for one level, 4 for another), or no space after colons. Use this validator to find the exact line and column of the error, then fix your spacing.
- Can YAML have comments?
- Yes, YAML supports comments using the # symbol. Everything after # on a line is a comment. Example: "name: John # Full name". Unlike JSON which does not allow comments, YAML comments are useful for documenting configuration files. When converting YAML to JSON, comments are removed since JSON has no comment syntax.
- Should I use tabs or spaces in YAML?
- Always use spaces, never tabs. The YAML specification explicitly forbids tabs for indentation. Most YAML parsers will reject files with tab characters. Configure your code editor to insert spaces when you press Tab (most editors call this "soft tabs"). Use 2 spaces per indent level for readability and consistency with most YAML style guides.
- How do I write multi-line strings in YAML?
- Use | (pipe) for literal block scalars (preserves newlines) or > (greater than) for folded scalars (folds newlines into spaces). Example: description: | This preserves\nline breaks. vs summary: > This folds line breaks into spaces. The pipe operator is ideal for scripts or preformatted text; the greater-than operator works well for long paragraphs.
- What are YAML anchors and aliases?
- YAML anchors (&) and aliases (*) let you reuse content. Define an anchor with &name and reference it with *name. Example: defaults: &defaults timeout: 30\nretries: 3\n\nprod: <<: *defaults\nhost: prod.com. This merges the defaults into prod. Anchors reduce duplication in large config files like Docker Compose or CI/CD pipelines.
- How do I validate YAML syntax?
- Paste your YAML into this validator and click Validate. The tool uses the js-yaml library to parse your YAML and reports errors with line and column numbers. Common errors include: bad indentation, missing colons, unquoted strings containing special characters, duplicate keys, and invalid escape sequences. Fix errors one at a time starting from the first reported error.