WebToolsPlanet
Converter Tools

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

Client-Side Processing
Input Data Stays on Device
Instant Local Execution

Find this tool useful? Support the project to keep it free!

Buy me a coffee

What 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

Browse the sections or use Ctrl+F to find a specific topic. Each entry shows the YAML syntax with a description and the equivalent JSON value. For validation, use the YAML Validator tool.

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.

YAML
name: Alice
age: 30
active: true
tags:
  - admin
  - user
address:
  city: London
Equivalent JSON
{"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.