Skip to content
IT glossary
ProgrammingUpdated December 3, 2026

YAML

A text format for storing structured data such as application settings. YAML files often use indentation to show which values belong together, making them easy to read and edit by hand.

What YAML is

YAML is a serialization format: it represents structured data as text so software can read it back into lists, mappings, and individual values. You'll often see it in files ending in .yaml or .yml. YAML does not define what a setting means. A key named retries, for example, has an effect only if the tool reading the file recognizes it and knows what to do with it.

How to read it

A mapping groups key–value pairs, typically written as key: value. A sequence is an ordered list; in block style, each item starts with a dash followed by a space. A scalar is a single value, such as a string, a number, or a Boolean. Block-style YAML uses indentation to show what's nested inside what. Use spaces, not tabs, for indentation, and align entries that belong to the same block. Two spaces per level is a convention, not a rule.

Example: application settings

notifications:
  enabled: true
  channels:
    - email
    - sms
  sender_id: "007"

The top-level key notifications holds a mapping with three entries. channels holds an ordered list, while enabled is a Boolean under the usual YAML schema. Quoting "007" makes it a string and preserves the leading zeros. If sender_id were lined up with notifications instead, the file could still parse, but the ID would be a top-level setting rather than part of notifications.

Why tools use YAML

Kubernetes manifests, Docker Compose files, and many CI/CD workflows use YAML because people can review and edit nested settings without writing braces around each block. Unlike standard JSON, YAML also supports # comments. For multiline text, use | when internal line breaks matter, or > to fold ordinary line breaks into spaces while keeping paragraph boundaries.

Common mistakes and interview questions

One frequent gotcha is assuming that unquoted text always stays text. A loader using YAML 1.1 rules may read on as a Boolean; under the YAML 1.2 Core schema, it's a string. Quote values that must remain strings, and check which loader and schema your tool actually uses. Mapping keys must also be unique: some loaders reject duplicates, while others silently keep one value. Don't rely on the latter behavior for overrides.

Interviewers may give you a configuration that parses but fails when the tool loads it. Separate parsing from application validation: parsing checks the YAML syntax and builds its data structure; validation checks whether the tool accepts that structure and its values. For example, replicas: "3" is valid YAML, but a tool that expects an integer can reject the string. A syntax check alone won't find that mismatch.