How to use the YAML Formatter
- Paste your YAML into the input panel on the left, or click “Load sample” to try an example.
- The output updates instantly in the right panel with syntax highlighting. If there are errors, the exact line and message appear at the bottom of the input.
- Configure the output — switch between 2 and 4-space indent, toggle JSON output, or sort keys alphabetically.
- Copy or apply — click Copy to copy the output, or Apply (←) to replace your input with the formatted version.
What is YAML?
YAML (YAML Ain't Markup Language) is a human-readable data serialisation language designed to be easy to write and read. Unlike JSON or XML, YAML uses indentation to represent structure — which makes it highly readable for configuration files but also sensitive to whitespace errors.
YAML is the standard format for Kubernetes manifests, GitHub Actions workflows, Docker Compose files, Ansible playbooks, and countless other DevOps and development tools. Consistent formatting is important because a misplaced space or inconsistent indent can cause a valid-looking file to fail silently.
Common YAML formatting mistakes
Inconsistent indentation
YAML requires consistent indentation throughout a file. Mixing 2-space and 4-space indents in the same file will cause a parse error. This formatter normalises all indentation to your chosen size.
Tabs instead of spaces
YAML explicitly forbids tab characters for indentation. Any tab will cause a parse error. Most editors can be configured to insert spaces when you press Tab, but if you paste YAML from another source, tabs can sneak in. This formatter removes tabs automatically.
Unquoted special characters
Values containing colons, hash signs, or other YAML control characters must be quoted. For example, a value like "http://example.com" needs quotes because the colon has a special meaning. The formatter adds quotes where needed.
Wrong boolean values
YAML 1.1 (used by many tools) interprets "yes", "no", "on", "off" as booleans. If you intend them as strings, they must be quoted. YAML 1.2 only treats "true" and "false" as booleans. Be explicit.
YAML vs JSON — when to use each
YAML and JSON represent the same data structures and are fully interconvertible. The choice between them comes down to context:
Use YAML when…
- ·Writing configuration files humans will read and edit
- ·You need comments (JSON has none)
- ·You want a cleaner look without braces and quotes
- ·Working with DevOps tooling (Kubernetes, Ansible, GitHub Actions)
Use JSON when…
- ·Sending data over HTTP APIs
- ·Your language's standard library parses it natively
- ·Strict interchange format is required
- ·You need wide tool compatibility (every language supports JSON)