Skip to main content

Last updated: April 28, 2026

What Is YAML? A Plain-English Guide (2026)

YAML is the language behind Kubernetes manifests, GitHub Actions workflows, Docker Compose files, and most modern config. This guide explains what YAML stands for, how the file format works, and the syntax you need to know.

Written by Mohan Raj Kolavi.

Quick answer: What is YAML?

YAML stands for YAML Ain't Markup Language. It is a human-readable data serialization language used for configuration files and data exchange. YAML uses indentation instead of brackets, supports comments, and represents the same data shapes as JSON (maps, lists, scalars) in a format easier for humans to edit. Files use the .yaml or .yml extension.

What does YAML stand for?

YAML stands for YAML Ain't Markup Language. It's a recursive acronym - the YAML at the start of the expansion is the same YAML being defined. The format was originally proposed in 2001 with the expansion Yet Another Markup Language, then renamed a year later to clarify that YAML is for data, not markup. The current spec is YAML 1.2, published in 2009 and revised in 2021.

The full form is sometimes spelled out as YAML Ain't a Markup Language. Both spellings appear in the official documentation and both refer to the same format.

The .yaml file format

A YAML file is plain UTF-8 text with the .yaml or .yml extension. Both extensions are identical - .yaml is the official recommendation, but .yml is widely used because some legacy tools assume three-character extensions.

YAML is whitespace-sensitive. Indentation - always with spaces, never tabs - defines the structure of nested maps and lists. The file format defines:

  • Maps - key-value pairs separated by a colon and a space.
  • Lists - items prefixed by a hyphen and a space.
  • Scalars - strings, numbers, booleans, and null.
  • Comments - any text after a hash character on a line.
  • Anchors / aliases - reusable references with &name and *name.
  • Block scalars - multiline strings using | for literal text or > for folded lines.

YAML syntax in 60 seconds

Here are the elements you'll use in 95% of YAML files:

ElementYAMLNotes
Map / key-valuename: AliceKey, colon, space, value
List- apple - pearHyphen plus space starts each item
Nested mapuser: name: Alice role: adminIndent with two spaces
Stringtitle: Hello worldQuotes optional unless ambiguous
Numbercount: 42No quotes - parsed as integer
Booleanenabled: truetrue / false (case-sensitive)
Nullowner: nullUse null or ~
Comment# This is a commentHash at start of line or after value
Multiline stringmessage: | line one line two| keeps newlines, > folds them
Anchor / aliasdefault: &def retries: 3 prod: <<: *defReuse a block elsewhere

A full YAML example

Here is a complete YAML file showing maps, lists, comments, booleans, and a multiline string:

example.yaml
# Sample YAML configuration
name: my-app
version: 1.4.2
production: true
servers:
  - host: api.example.com
    port: 443
  - host: web.example.com
    port: 80
features:
  auth: enabled
  rateLimit: 100
description: |
  A multiline description
  spanning two lines.

Try this in our YAML editor to see live validation and syntax highlighting, or paste it into the YAML to JSON converter to see the equivalent JSON.

YAML vs JSON

YAML and JSON describe the same data shapes, so any YAML document can be converted to JSON. The differences are about ergonomics and feature set:

AspectYAMLJSON
File extension.yaml or .yml.json
CommentsYes (#)No native support
Trailing commasNot usedNot allowed
Anchors / aliasesYesNo
Multiple documents per fileYes (--- separators)No
IndentationWhitespace-significantBrackets define structure
Booleanstrue / false (also yes / no)true / false only
Multiline stringsNative (| and >)Escape \n manually
File sizeSmaller (no brackets)Slightly larger
Best forConfigs, infra-as-code, human editsAPIs, machine-to-machine

Same data, two formats:

Comparison
# YAML
name: my-app
version: 1.4.2
production: true

# Equivalent JSON
{
  "name": "my-app",
  "version": "1.4.2",
  "production": true
}

For a deeper comparison, read our dedicated YAML vs JSON guide.

Where YAML is used

YAML is the default config format across modern infrastructure and developer tooling:

  • Kubernetes - manifests for deployments, services, ingress, and every other resource use YAML.
  • GitHub Actions - workflow files in .github/workflows/.
  • Docker Compose - docker-compose.yaml service definitions.
  • Ansible - playbooks, inventory, and role definitions.
  • OpenAPI / Swagger - API specifications.
  • GitLab CI / CircleCI / Travis - pipeline config.
  • Helm - chart values and templates.
  • Hugo / Jekyll - site config and post front matter.
  • Cloud-init - server bootstrap config for AWS, GCP, and Azure.

Free YAML tools on this site

Our YAML toolset covers the most common day-to-day tasks:

For specific topics, see our guides on YAML comments, multiline strings, and .yml vs .yaml.

Frequently Asked Questions

What does YAML stand for?

YAML stands for YAML Ain't Markup Language. It's a recursive acronym - the YAML at the start of the expansion is the same YAML being defined. The original 2001 expansion was Yet Another Markup Language, but it was renamed in 2002 to emphasize that YAML is for data, not markup.

What is YAML used for?

YAML is used primarily for configuration files. Major uses include Kubernetes manifests, GitHub Actions workflows, Docker Compose files, Ansible playbooks, OpenAPI specifications, GitLab CI configs, CircleCI configs, Helm charts, and Hugo or Jekyll site front matter. Anywhere humans need to read and edit structured config, YAML tends to be the format of choice.

Is YAML a programming language?

No. YAML is a data serialization language - it represents data structures (maps, lists, scalars) in a human-readable text format. It has no control flow, no variables, and no execution model. You write YAML, then a program reads it and acts on the values.

What is a .yaml file?

A .yaml file is a plain text file containing YAML-formatted data. It uses indentation, colons, and hyphens to express maps and lists. The .yml extension is identical - it's just a shorter alias used by some communities and tools.

Is .yml the same as .yaml?

Yes. They are the same format. The official YAML site recommends .yaml for new files, but .yml is widely used for legacy and Windows-friendly reasons. Every modern YAML parser handles both extensions identically.

What is the difference between YAML and JSON?

YAML and JSON describe the same data shapes - maps, lists, and scalars - but YAML is whitespace-sensitive and supports comments, anchors, and multi-document files. JSON uses brackets and is stricter, which makes it easier for machines to parse but harder for humans to write. Every JSON document is also valid YAML.

Is JSON valid YAML?

Yes, since YAML 1.2. The YAML 1.2 spec was explicitly designed to be a superset of JSON, so any JSON document is also a valid YAML document. The reverse is not true - YAML features like comments and anchors have no JSON equivalent.

What indentation does YAML use?

YAML uses spaces for indentation. Tabs are not allowed by the spec. Two spaces per level is the community default and what Kubernetes, GitHub Actions, and Docker Compose use. The exact width does not matter as long as it's consistent within each map or list.

Can YAML have comments?

Yes. Comments start with the hash character (#) and run to the end of the line. They can appear at the start of a line or after a value. YAML does not have a block comment syntax - you must place a # at the start of every commented line.

How do I write multiline strings in YAML?

Use a literal block scalar (|) to keep newlines as written, or a folded block scalar (>) to fold newlines into spaces. Add a chomping indicator (- to strip the trailing newline, + to keep all trailing newlines) to fine-tune the output. See our multiline strings guide for examples.

What are YAML anchors and aliases?

An anchor (&name) marks a node so you can reference it elsewhere with an alias (*name). The merge key (<<: *name) merges the referenced map into the current map. Anchors let you DRY up repeated config without external templating.

Is YAML hard to learn?

No. The basics - keys with colons, lists with hyphens, indentation for nesting - take about ten minutes. The harder parts are the edge cases: when to quote strings, how block scalars chomp newlines, how anchors work. Use a validator while you learn so you catch indentation mistakes early.

What Is YAML? YAML Guide, Meaning, and File Format (2026) | Kolavi Studio