What is YAML?

YAML (YAML Ain't Markup Language) is a human-readable data serialization language commonly used for configuration files and data exchange. It uses indentation to represent structure, making it more readable than JSON or XML for complex nested data.

Quick Facts

Full NameYAML Ain't Markup Language
Created2001 by Clark Evans, Ingy döt Net, Oren Ben-Kiki
SpecificationOfficial Specification

How YAML Works

YAML uses whitespace indentation to denote structure, eliminating the need for brackets or tags. It supports multiple data types including strings, numbers, booleans, null, arrays (sequences), and objects (mappings). YAML allows comments (starting with #), multi-line strings, and anchors/aliases for reusing content. It's a superset of JSON, meaning valid JSON is also valid YAML. YAML is widely used in DevOps tools like Docker Compose, Kubernetes, Ansible, and CI/CD pipelines.

Key Characteristics

  • Uses indentation for structure (spaces only, no tabs)
  • Supports comments with # symbol
  • Multi-line string support with | and > operators
  • Anchors (&) and aliases (*) for content reuse
  • Superset of JSON - all JSON is valid YAML
  • Multiple documents in one file separated by ---

Common Use Cases

  1. Configuration files (Docker Compose, Kubernetes)
  2. CI/CD pipeline definitions (GitHub Actions, GitLab CI)
  3. Infrastructure as Code (Ansible, CloudFormation)
  4. API specifications (OpenAPI/Swagger)
  5. Static site generators (Jekyll, Hugo)

Example

# Server configuration
server:
  host: localhost
  port: 8080
  ssl: true

database:
  type: postgresql
  credentials:
    username: admin
    password: secret

features:
  - authentication
  - logging
  - caching

Related Tools on QubitTool

Related Concepts