Skip to main content

YAML

YAML Ain't Markup Language

Pronunciation
YAM-ul
Updated 2 min read

Share this page

Send the link, quote the definition with a link back, or show it as a card on your own site.

https://softwaredictionary.org/terms/yaml

In short

YAML is a human-readable data format that uses indentation instead of brackets, widely used for configuration files in DevOps tools and CI/CD pipelines.

What is YAML?

YAML is a text format for writing structured data, such as settings, lists, and nested objects, in a way that is easy for people to read and edit. Files use the .yaml or .yml extension. The name is a recursive acronym for YAML Ain't Markup Language, chosen to stress that it is meant for data rather than documents; it originally stood for Yet Another Markup Language.

YAML uses indentation with spaces to show structure, so there are no curly braces or closing tags, and tabs are not allowed. A key: value pair defines a field, a line starting with - defines a list item, and indenting lines under a key nests them inside it. Comments start with #, and a single file can hold multiple documents separated by ---.

You will find YAML almost everywhere in DevOps: Kubernetes manifests, Docker Compose files, CI/CD pipeline definitions, and API descriptions written in the OpenAPI format. Think of it as a neatly indented outline, where the indentation alone tells you which details belong under which heading.

YAML is often compared with JSON. YAML 1.2 was designed as a superset of JSON, so almost any valid JSON document is also valid YAML, but YAML adds comments and a less cluttered syntax. The trade-off is that its flexibility can surprise you: a wrong indent silently changes the meaning, and unquoted values like no or on may be read as booleans by parsers that follow the older YAML 1.1 rules, so quote strings when in doubt.

Key takeaways

  • YAML is a human-readable format for structured data and configuration.
  • Indentation with spaces defines structure; tabs are not allowed.
  • It supports comments with #, unlike JSON.
  • YAML 1.2 is a superset of JSON, so most JSON is valid YAML.
  • Quote ambiguous values such as no, yes, or on to avoid surprise type conversions.

Example

A small YAML configuration fileyaml
# A simple service configuration
name: web-app
version: 2
debug: false

server:
  host: 0.0.0.0
  port: 8080

# A list of allowed origins
allowedOrigins:
  - https://example.com
  - https://admin.example.com

Readers ask

What is the difference between .yaml and .yml?

There is no difference in content; both extensions mean a YAML file. The official recommendation is .yaml, but .yml is common because some older systems limited file extensions to three characters.

Is YAML better than JSON?

Neither is strictly better. YAML is easier for humans to write and supports comments, which makes it popular for configuration, while JSON is simpler, stricter, and faster to parse, which makes it the usual choice for APIs.

Why do I get indentation errors in YAML?

Because indentation defines structure, mixing tabs with spaces or misaligning a single line breaks or changes the meaning. Use spaces only, keep indentation consistent, and run a YAML linter or validator to catch mistakes early.

See also

Spotted a mistake or something missing on this page?Suggest an edit

Read a random page
Open today's review
Switch to the dark theme
Read this page in Türkçe

More

Settings