Free Online YAML Formatter & Validator
Format, validate, and beautify YAML in your browser, and convert between YAML and JSON. Works with Docker Compose, Kubernetes, and GitHub Actions configs. Nothing is ever sent to a server.
What is YAML?
YAML (YAML Ain't Markup Language) is a human-readable data serialization format designed to be easy to write and read. Its clean, indentation-based syntax has replaced XML in many modern configuration files, powering tools such as Docker Compose, Kubernetes, GitHub Actions, Ansible, and Helm. YAML is also a superset of JSON, so every valid JSON document is also valid YAML — which makes converting between the two formats straightforward and lossless for most everyday configuration data.
YAML Syntax Guide
| key: value | Scalars — a simple key/value pair. Multiline strings use | (literal, keeps newlines) or > (folded, joins lines). |
| - item | Lists — each item on its own line, prefixed with a dash and a space. |
| parent: child: x | Nested dictionaries — express hierarchy purely through indentation. |
| # comment | Comments — anything after a # is ignored by the parser. |
| null / true / false | Special values — null, true, and false are recognised as typed values, not strings. |
| &anchor / *alias | Anchors & aliases — define a node once with &anchor and reuse it with *alias. |
YAML vs JSON: When to Use Which
YAML
Use YAML for configuration files written and edited by hand. It supports comments, is more readable, and is the standard for Docker Compose, Kubernetes, GitHub Actions, Ansible, and Helm.
JSON
Use JSON for APIs and data in transit. It parses faster, has no type ambiguity, and is the format behind REST APIs, package.json, and tsconfig.json.
Common YAML Errors and How to Fix Them
- Using tabs instead of spaces for indentation — replace every tab with spaces, since YAML forbids tabs.
- Inconsistent indentation — keep the same number of spaces at each nesting level throughout the document.
- A string containing a colon that is not quoted — wrap values like "12:30" or "http://example.com" in quotes.
- Ambiguous booleans — values such as yes, no, on, and off are parsed as true/false; quote them if you mean the literal words.
- Special characters in a value without quoting — characters like @, #, and { need the value wrapped in quotes.