What is YAML (YAML Ain't Markup Language)?

YAML is a human-friendly data format that uses indentation instead of brackets, favored for configuration files in DevOps and application settings.

YAML, a recursive acronym for "YAML Ain't Markup Language", is a data serialization format designed to be easy for humans to read and write. Instead of the braces and brackets of JSON, YAML uses indentation to express structure, along with dashes for list items and colons for key-value pairs. The result is clean, uncluttered files that feel closer to writing an outline than coding a data structure.

YAML has become the default for configuration across modern infrastructure. Docker Compose, Kubernetes manifests, GitHub Actions workflows, CI/CD pipelines, and countless application config files are written in YAML because it is comfortable to edit by hand and supports comments - something JSON lacks. Any JSON document is also valid YAML, so the two formats convert cleanly between each other.

The reliance on indentation is both YAML's greatest strength and its most common pitfall. Mixing tabs and spaces, or getting an indentation level wrong by a single space, changes the meaning of the document or causes a parse error. Because whitespace is significant, editing YAML demands care, and a validator or converter helps catch structural mistakes before they reach production.

YAML supports advanced features that reward experienced users: anchors and aliases to reuse blocks, multi-line string styles for embedding scripts or descriptions, and explicit typing. These features can also introduce subtle bugs - the classic example being the value 'no' being interpreted as the boolean false - so quoting ambiguous strings is a good habit when precision matters.

Examples

  • name: Ada\nroles:\n - admin\n - editor
  • A nested map:\ndatabase:\n host: localhost\n port: 5432
  • Quoting to avoid surprises: country: "NO" keeps it a string, not false

Common questions

Can I use tabs for indentation in YAML?
No. The YAML specification forbids tabs for indentation. Use spaces only, and configure your editor to insert spaces so you never accidentally introduce a tab.
Is YAML better than JSON?
For configuration edited by humans, YAML's readability and comment support are advantages. For machine-to-machine data exchange, JSON's stricter, less ambiguous grammar is usually the safer choice.
How do I convert YAML to JSON?
Because JSON is a subset of YAML, conversion is straightforward with a converter. This is handy when a tool accepts only JSON but you prefer authoring in YAML.

Related tools

Related terms for YAML (YAML Ain't Markup Language)