YAML Cheat Sheet

Search common YAML syntax for maps, lists, comments, booleans, nulls, multiline strings, and anchors.

Last updated: August 2026 | By Workshelve Team

Maps

name: Workshelve

A key followed by a scalar value.

Nested maps

site:
  title: Workshelve
  live: true

Indent child keys with spaces.

Lists

tools:
  - YAML Beautifier
  - YAML Validator

Use a dash and a space for each list item.

Objects in lists

users:
  - name: Ada
    role: admin

Indent extra keys under the first list item key.

Comments

# deployment settings

Comments start with # and continue to the end of the line.

Strings

title: "Use quotes when: punctuation matters"

Quote strings that contain special YAML characters.

Booleans

enabled: true
archived: false

Use true and false for boolean values.

Nulls

owner: null

Use null when a key is intentionally empty.

Literal blocks

body: |
  Line one
  Line two

The pipe preserves line breaks within the block; trailing line-break behavior depends on the chomping indicator.

Folded blocks

summary: >
  Long text can wrap
  across several lines.

The greater-than marker folds lines into text.

Document markers

---
name: first
---
name: second

Triple dashes can separate documents.

Anchors

defaults: &defaults
  retries: 3
job:
  <<: *defaults

Anchors reuse blocks in YAML processors that support merges.

YAML basics

Spaces matter

YAML uses indentation to show hierarchy. Use spaces for indentation; tabs are not allowed as indentation characters.

Quote carefully

Quotes are helpful when values contain colons, hashes, braces, or leading zeros.

Related Tools