What Is YAML? A Practical Guide for Developers
Back to Articles
DevOps

What Is YAML? A Practical Guide for Developers

Learn YAML syntax, data types, and best practices. Understand how YAML compares to JSON and where it's used in DevOps, Kubernetes, and configuration management.

DailyUtil Team May 14, 2026 1 min read 0 words
What Is YAML? A Practical Guide for Developers

What Is YAML?

YAML (YAML Ain't Markup Language) is a human-readable data serialisation format. It's designed to be easy to read and write by humans while remaining simple for machines to parse.

YAML is the dominant configuration format in the DevOps ecosystem - used by Docker Compose, Kubernetes, GitHub Actions, Ansible, and many CI/CD tools.

YAML Syntax Basics

Key-Value Pairs

name: DailyUtil
version: 1.0.0
description: Free developer tools

Nested Objects (Indentation)

database:
  host: localhost
  port: 5432
  name: dailyutil_db

YAML uses spaces for indentation (never tabs). The standard is 2 spaces per level.

Lists (Arrays)

tools:
  - JSON Viewer
  - Base64 Encoder
  - JWT Decoder
  - UUID Generator

Inline Syntax

tools: [JSON Viewer, Base64 Encoder, JWT Decoder]
config: {host: localhost, port: 5432}

YAML Data Types

TypeExample
Stringname: DailyUtil
Numberport: 5432
Booleanenabled: true
Nullvalue: null or value: ~
Datecreated: 2026-05-14

Multiline Strings

Literal block (|) - preserves newlines:

description: |
  This is line one.
  This is line two.

Folded block (>) - joins lines with spaces:

description: >
  This is a very long
  description that wraps
  across multiple lines.

YAML vs JSON

FeatureYAMLJSON
Readability✅ Very human-friendly⚠️ More verbose
Comments# comment❌ Not supported
Data types✅ Dates, multiline strings❌ Strings, numbers only
Complexity⚠️ Anchors, aliases✅ Simple
Use caseConfig filesAPIs, data exchange

Common YAML Mistakes

  1. Using tabs - YAML only allows spaces for indentation
  2. Unquoted special strings - yes, no, on, off are parsed as booleans. Use quotes: "yes"
  3. Inconsistent indentation - mixing 2-space and 4-space indentation causes parse errors
  4. Forgetting colons in nested keys - key value instead of key: value
  5. Norway problem - the country code NO is parsed as boolean false. Always quote: "NO"

Where Is YAML Used?

  • Docker Compose - docker-compose.yml
  • Kubernetes - pod, deployment, service manifests
  • GitHub Actions - .github/workflows/*.yml
  • Ansible - playbooks and inventory
  • CI/CD - GitLab CI, CircleCI, Travis CI

View and Validate YAML

Use our YAML Viewer & Formatter to parse, format, and explore YAML documents with tree navigation - all in your browser.

Share this article