What is YAML?
A YAML file uses indentation (spaces, never tabs) to show hierarchy, colons for key-value pairs, and dashes for list items. Strings don't need quotes unless they contain special characters. Comments start with `#`. YAML supports anchors (`&name`) and aliases (`*name`) to reference the same value in multiple places, reducing repetition in complex configuration files. YAML also supports multiple documents in a single file separated by `---`. The format's flexibility can be a source of errors — the 'Norway problem' (where the string 'NO' is parsed as boolean false by some YAML parsers) is a famous example of YAML's implicit type coercion causing bugs.
YAML pros and cons
Advantages
- Comments supported — explain configuration inline with # comment syntax
- More readable than JSON for complex nested structures (no brackets/braces)
- Multi-line strings with literal block (|) and folded (>) styles
- Anchors and aliases reduce repetition in large config files
- Standard format for Docker Compose, Kubernetes, GitHub Actions, Ansible
Limitations
- Indentation errors are silent and hard to debug — a wrong indent changes meaning
- Implicit type coercion causes bugs (strings parsed as booleans, numbers)
- More complex to parse than JSON — higher security risk from untrusted input
- Multiple equivalent syntaxes (flow style vs block style) can be confusing
- Not suitable for data interchange — use JSON or CSV for APIs and databases
When should you convert YAML files?
Use YAML for configuration files that humans frequently edit — CI/CD pipelines, Docker Compose, Kubernetes manifests, Helm charts, Ansible playbooks. Convert YAML to JSON when consuming data in JavaScript applications, REST APIs, or tools that don't support YAML. Always use `yaml.safe_load()` (Python) or equivalent safe loaders when parsing YAML from untrusted sources to prevent code execution via YAML type tags.
All FormatDrop conversions run entirely in your browser — no file upload, no server processing. Your files stay on your device.
YAML FAQ
Why does YAML parse 'NO' as false?
How do I validate a YAML file?
What are YAML anchors and aliases?
More formats