What YAML is used for
YAML is a plain-text data format built around indentation, used mainly for configuration. Docker Compose files, Kubernetes manifests, GitHub Actions and GitLab CI pipelines, Ansible playbooks, OpenAPI specs and the front matter at the top of static-site pages are all written in YAML. It describes the same maps, lists and scalars as JSON, with less punctuation and support for comments.
This page gives you a browser editor for that kind of file. You get syntax highlighting, find and replace, word wrap, a light or dark theme, fullscreen, copy, and a download button that saves config.yaml. Tab inserts indentation and line numbers run down the left, which helps when an error message points at "line 14, column 5".
What it doesn't do: it doesn't parse or validate the document, and there's no formatter. A file can be highlighted nicely and still fail to load, so test it with the program that will read it.
A Docker Compose file to try
Paste this in. It shows nested mappings, block sequences, a comment, quoted strings and a folded block scalar:
# compose.yaml: a small web app with a reverse proxy
services:
web:
image: nginx:1.27-alpine
ports:
- "8080:80"
volumes:
- ./site:/usr/share/nginx/html:ro
depends_on:
- api
api:
build: ./api
environment:
APP_ENV: production
ENABLE_CACHE: "yes"
command: >
gunicorn app:server
--bind 0.0.0.0:8000
--workers 2
The > folds the three command lines into one line separated by spaces, keeping a single trailing newline. Use | instead when line breaks must be kept (a shell script, a certificate), and add - (>-, |-) to drop the final newline.
Gotchas worth knowing
Indentation is spaces only. The YAML 1.2.2 specification says tab characters must not be used for indentation. A tab that sneaks in from another editor is one of the most common causes of "found character that cannot start any token".
Booleans depend on the YAML version. YAML 1.1 had a long list of boolean spellings, including yes, no, on and off. That is why country: NO became false in Python projects (the "Norway problem"), and why PyYAML reads the GitHub Actions key on: as True. The YAML 1.2 core schema only resolves true and false, but plenty of parsers still implement 1.1. Quoting "yes" in the example above keeps it a string everywhere.
Colons and hashes inside values. title: Note: read this fails, because : starts a new mapping. # starts a comment, so color: #fff gives an empty value in most parsers. Wrap such values in quotes. Single quotes are literal (write '' for a quote character), and double quotes allow escapes like \n.
Numbers that look like times. YAML 1.1 parses unquoted 22:22 as a base-60 number. The Docker Compose documentation recommends quoting port mappings for exactly this reason.
Checking the file locally
- Click Download and rename the file to whatever your tool expects, for example
compose.yaml. - Run the tool's own check where it has one:
docker compose configprints the resolved Compose file or the parse error, andkubectl apply --dry-run=client -f file.yamldoes the same for Kubernetes. - For a general lint, install yamllint with
pip install yamllintand runyamllint file.yaml. It catches tabs, duplicate keys, trailing spaces and the truthy values above.
Related editors and tools
YAML and JSON describe the same data, so the JSON editor is handy when an API wants JSON instead. The JSON validator and JSON formatter help once you've converted. For XML-based config, use the XML editor, or browse every language on the online code editors page.
Last updated