YAML Cheat Sheet
Everything you need to know about YAML syntax — scalars, sequences, mappings, multi-line strings, anchors, and the type coercion gotchas that catch everyone.
Last updated: May 21, 2026
Find this tool useful? Support the project to keep it free!
Buy me a coffeeWhat is YAML Cheat Sheet?
YAML (YAML Ain't Markup Language) is a human-friendly data serialization format used extensively for configuration files (Docker Compose, GitHub Actions, Kubernetes, Ansible, etc.). It uses indentation for structure instead of brackets, making it readable but sensitive to whitespace.
This cheat sheet covers all YAML syntax: scalar types and their auto-detection, block and flow styles, multi-line string blocks, anchors (`&`) and aliases (`*`), and the notorious type coercion pitfalls that cause unexpected parse results.
How to Use YAML Cheat Sheet
Common Use Cases
- DevOps engineers writing Kubernetes manifests, Docker Compose, or Ansible playbooks.
- Developers configuring GitHub Actions workflows who need YAML syntax reminders.
- Students learning YAML who want a structured reference alongside JSON.
- Engineers debugging YAML parse errors caused by indentation or type coercion.
Example Input and Output
YAML mapping demonstrating key scalar types and sequences.
name: Alice
age: 30
active: true
tags:
- admin
- user
address:
city: London{"name":"Alice","age":30,"active":true,"tags":["admin","user"],"address":{"city":"London"}}Tip: use a validator
YAML indentation errors are hard to spot visually. Paste your YAML into the YAML Validator to get the exact line of the parse error.
Frequently Asked Questions
Why does "yes" become true in YAML?
YAML 1.1 (used by many parsers) auto-converts yes, no, on, off, true, false (and their capitalised variants) to booleans. YAML 1.2 only treats true/false as booleans. Quote the string to prevent coercion: "yes".
What is the difference between | and > in multi-line strings?
| (literal block) preserves newlines exactly. > (folded block) folds newlines into spaces (like word-wrap), making the string a single line. Both preserve a trailing newline by default.
Can YAML have comments?
Yes — YAML supports comments with #. Unlike JSON, YAML comments are official syntax and are ignored by parsers.
Related Tools
YAML Validator
Validate YAML syntax online. Shows valid/invalid status with exact error line and column, plus structure stats for valid documents.
YAML Beautifier
Format and prettify YAML with configurable indentation and optional key sorting. Validates YAML syntax instantly.
YAML to JSON Converter
Convert YAML to JSON and JSON to YAML — for config files, CI pipelines, and Kubernetes manifests.
YAML to XML Converter
Convert YAML to XML online. Supports nested objects, arrays, and custom root element names with optional XML declaration.
JSON Cheat Sheet
A complete JSON reference — data types, syntax rules, nested structures, common patterns, and gotchas. Quick lookup for developers working with JSON APIs and configs.
CSS Selector Cheat Sheet
A complete reference for CSS selectors — basic, attribute, pseudo-class, pseudo-element, and combinator selectors with syntax and examples.

