What is YAML?
YAML (YAML Ain't Markup Language) is a human-readable data serialization language commonly used for configuration files and data exchange between programming languages. YAML uses indentation to represent data structures, making it clean and easy to read.
Originally standing for "Yet Another Markup Language," YAML was redesigned to emphasize its data-oriented nature. It's widely used in modern DevOps tools, including Docker, Kubernetes, Ansible, and CI/CD pipelines.
History
YAML was first proposed by Clark Evans in 2001, with contributions from Ingy döt Net and Oren Ben-Kiki. Version 1.0 was released in 2004, and YAML 1.2 (2009) remains the current specification.
The format gained widespread adoption in the 2010s with the rise of containerization and infrastructure-as-code practices, becoming the de facto standard for Kubernetes manifests and CI/CD configuration.
Key Features
- Human-Readable: Clean, minimal syntax
- Indentation-Based: Uses whitespace for structure
- Data Types: Scalars, lists, dictionaries
- Comments: Supports inline documentation
- References: Anchors and aliases for reusability
- Multi-Document: Multiple documents in one file
- Unicode Support: International characters
- Language-Agnostic: Works with any programming language
Common Uses
- Kubernetes manifests and configs
- Docker Compose files
- CI/CD pipeline definitions (GitHub Actions, GitLab CI)
- Ansible playbooks
- Application configuration files
- API specifications (OpenAPI/Swagger)
- Data serialization and exchange
- Static site generators (Jekyll, Hugo)
Advantages
- Extremely readable and writable
- Less verbose than XML or JSON
- Supports comments for documentation
- Natural representation of data structures
- Supports complex data types
- Wide tooling and language support
- Perfect for configuration files
Limitations
- Indentation sensitivity can cause errors
- Tabs vs spaces issues
- Complex specification with edge cases
- Slower parsing than JSON
- Security concerns with arbitrary code execution
- Not ideal for deeply nested structures
- Difficult to generate programmatically
Technical Information
YAML uses a combination of indentation (spaces, not tabs), key-value pairs, lists, and special characters to represent data. It's a superset of JSON, meaning any valid JSON is also valid YAML.
| File extension | .yaml, .yml |
| MIME type | text/yaml, application/x-yaml |
| Developed by | Clark Evans, Ingy döt Net, Oren Ben-Kiki |
| First released | 2001 |
| Current version | 1.2 (2009) |
| Format type | Data serialization |
| Character encoding | UTF-8, UTF-16 |