YAML explained in plain terms means understanding the plain-text format that lets people write structured data in a way that is easy to read and easy for a machine to parse. The central question is why configuration files, the small files that tell software how to behave, are so often written in YAML rather than in code, and the short answer is that YAML uses indentation and simple punctuation to express structure, so a person can read the file at a glance and a program can load it without ambiguity.
Most people never write YAML directly, but they use software that depends on it. The settings for a website, the steps of an automated deployment, and the definition of a cloud service are often YAML files, edited by developers and read by machines, and a single misplaced space can stop the whole thing working.
That fragility is the price of its readability, and it is worth understanding, because YAML is now one of the most common formats in modern software. This article explains what YAML is, how it works, and how it compares with JSON and other formats.
Key takeaways
- YAML is a plain-text format for structured data, designed to be read by people.
- Indentation defines the structure, so spacing is part of the meaning.
- It supports lists, maps, and nested combinations of the two.
- YAML is a superset of JSON, so valid JSON is also valid YAML.
- It is the standard choice for configuration files in modern software.
What YAML is
YAML, which originally stood for Yet Another Markup Language and now stands for YAML Ain’t Markup Language, is a data format created in 2001 to be more readable than the formats it replaced. It was designed for configuration files and data exchange, the places where a person writes the file and a machine reads it, and where clarity matters more than compactness.
The format’s central idea is that structure should be visible. Where JSON uses braces and brackets to show nesting, YAML uses indentation: a line indented further belongs to the line above it, just as an outline in a word processor shows sections inside sections. The result is a file that reads almost like a list, with very little punctuation getting in the way.
A YAML file is a series of key and value pairs, written as a key, a colon, and a space, followed by the value. Lists are written with a dash and a space before each item, and deeper structure is made by indenting further. The format also supports comments, written after a hash sign, and multi-line text, so a file can explain itself as well as define data. Our guide to JSON explains the format YAML is most often compared with, and our guide to HTML explains the markup language that YAML deliberately chose not to resemble.
How YAML works
A YAML parser reads the file line by line, turning indentation into structure. When it sees a key at the left margin, it knows a new top-level entry has begun, and when it sees lines indented beneath it, it knows those lines belong to that entry. The parser builds a tree of maps and lists, and hands that tree to the program, which can then look up any value by its path through the structure.
Values in YAML need no quotation marks in most cases. A plain word is a string, a number is a number, and the words true and false are booleans, which means a typical configuration file is almost free of punctuation. Quotation marks are available when they are needed, for example when a value begins with a character that has a special meaning, or when it must be treated as text even though it looks like a number.
Indentation is the part that catches beginners. YAML forbids tabs for indentation and requires spaces, and the number of spaces must be consistent within a block. Mixing two spaces in one place and four in another is an error, and so is a single line indented one space too far. Most editors can be set to show invisible characters, and that one setting saves hours of confusion.
The format also has features for larger files. A value can be written once and reused elsewhere with anchors and aliases, so a long repeated block need not be copied, and several documents can live in one file, separated by a line of three dashes. These features are powerful, but they are also the source of some of YAML’s most confusing errors, and many teams agree to avoid them.
Because YAML is a superset of JSON, any JSON document is also valid YAML, which makes migration easy: a system that reads YAML can read JSON without any change. The reverse is not true, since YAML’s indentation syntax has no equivalent in JSON, and a JSON parser will reject a typical YAML file.

Comparing YAML with JSON
YAML and JSON both describe structured data in plain text, but they make opposite trade-offs. One is built to be read by people, the other to be read by machines, and the right choice depends on who will be editing the file.
The table below sets out the main contrasts between the two.
| Aspect | YAML | JSON |
|---|---|---|
| Readability | High, almost no punctuation | Moderate, braces and quotes everywhere |
| Structure | Indentation | Braces and brackets |
| Comments | Supported with a hash sign | Not supported |
| Strictness | Spacing errors break the file | Any whitespace is fine |
| Best for | Configuration people edit | Data machines exchange |
The practical result is that YAML wins for configuration files that a person writes and maintains, while JSON wins for data passed between programs, where readability matters less than strictness. Many projects use both, in exactly those roles.
Where YAML is used
Cloud and deployment configuration is YAML’s largest use. Tools such as Kubernetes, Docker Compose, and Ansible all define their work in YAML files, describing which containers to run, how they connect, and what steps to take. A developer edits the file, and the tool reads it and makes the infrastructure match.
Continuous integration pipelines are defined in YAML. Services such as GitHub Actions and GitLab CI read a YAML file that lists the steps to build, test, and deploy a project, and every change to the pipeline is a change to that file, reviewed like any other code.
Application settings are often YAML. A web application may keep its database address, its feature flags, and its email settings in a YAML file, so that changing a setting is a matter of editing one line rather than changing code. The file is loaded when the application starts, and the values are available everywhere.
Static site generators and documentation tools use YAML for frontmatter, the block of metadata at the top of a page that gives its title, date, and author. The page itself is written in Markdown, and the YAML block tells the generator how to present it.
Data exchange between teams sometimes uses YAML, especially when the data is small and a person needs to read it. A list of test cases, a translation file, or a set of example records is often easier to maintain in YAML than in a database, and it can be kept in version control alongside the code.
Strengths and limits
The greatest strength of YAML is readability. A configuration file that a person can understand without a manual is less likely to be misconfigured, and a mistake is easier to spot, because the structure is visible in the shape of the text itself.
It is also a strength that YAML is widely supported. Every major programming language has a YAML parser, and every modern tool that reads configuration expects it, so a file written once can be read anywhere.
The limits are real, though. Indentation errors are easy to make and hard to see, the format’s flexibility means the same data can be written in many confusing ways, and some features, such as anchors, behave in surprising ways. YAML is also slower to parse than JSON, and it is a poor choice for large data, where its verbosity becomes a burden.
YAML checklist
- Use spaces for indentation, never tabs.
- Keep indentation consistent within each block.
- Quote values that look like numbers or dates but are really text.
- Validate the file with a linter before committing it.
- Keep lines short and structure shallow, so the file stays readable.
- Add comments to explain anything that is not obvious.
- Avoid anchors and aliases unless the whole team understands them.
- Remember that valid JSON is also valid YAML.
- Check the file after editing, since one space can change its meaning.
Frequently asked questions
What is YAML in simple terms?
YAML is a plain-text format for writing structured data, such as settings and lists, in a way that people can read easily. It uses indentation to show structure instead of brackets and braces.
What is YAML used for?
Mostly configuration files: the files that tell software, cloud tools, and deployment pipelines how to behave. It is the standard format for tools such as Kubernetes and GitHub Actions.
Why does indentation matter in YAML?
Because indentation is how YAML expresses structure. A line indented further belongs to the line above it, so changing the spacing changes the meaning, and inconsistent spacing is an error.
Is YAML the same as JSON?
No, but they are related. YAML is a superset of JSON, so any JSON document is valid YAML, but YAML has extra features, such as comments and indentation-based structure, that JSON does not.
Can I use tabs in YAML?
No. YAML forbids tabs for indentation and requires spaces. Mixing tabs and spaces is one of the most common errors, and most editors can be set to insert spaces automatically.
What does YAML stand for?
It originally stood for Yet Another Markup Language, and was later renamed to YAML Ain’t Markup Language, a joke that makes the point: YAML is a data format, not a markup language like HTML.
The bottom line
YAML explained in one line is this: a plain-text format that uses indentation to express structure, so configuration files are easy for people to read and easy for machines to load.
It has become the default language of modern configuration, from cloud infrastructure to build pipelines, precisely because it trusts the reader to understand the shape of the text. Its one great demand is care with spacing, and the tools that validate it exist because a single misplaced space can stop a deployment in its tracks.
This article is general information about how YAML works, not advice about configuring a particular tool or system.







