📐
YAML Formatter
Format · validate with line numbers · YAML ↔ JSON · tree view · multi-document files
Ctrl+Enter = run
Output
Output appears here

YAML Formatter & Validator

Free online YAML formatter and validator. Beautify YAML, see the exact line and column of any syntax error, convert YAML to JSON or JSON to YAML, and browse the result as a tree. Handles multi-document files with ---. Fully client-side using js-yaml — nothing is sent to any server.

Free No login 100% browser-based Your input never leaves your device

Try these next

What is a YAML Formatter?

YAML (YAML Ain't Markup Language) is a human-readable data serialisation format used heavily in configuration files — Kubernetes manifests, Docker Compose files, GitHub Actions workflows, and Ansible playbooks are all YAML. Its indentation-based structure is readable but unforgiving: a single wrong indent causes a parse error that can be hard to locate.

This tool parses, validates, and reformats YAML using the js-yaml library in your browser. Paste any YAML to check for syntax errors, normalise indentation (2 spaces), and produce clean, canonical output. Also converts YAML to JSON for quick inspection.

What is YAML?
YAML (YAML Ain't Markup Language) is a human-readable data serialization format commonly used for configuration files. It uses indentation to represent structure, making it more readable than JSON or XML. Popular in Kubernetes, Docker Compose, GitHub Actions, and Ansible.
What's the difference between YAML and JSON?
YAML is a superset of JSON — any valid JSON is also valid YAML. YAML supports comments (JSON doesn't), uses indentation instead of braces, and is more readable for complex config files. JSON is better for APIs and data exchange due to its simplicity and broad language support.
Does this tool turn yes, no, on and off into booleans?
No. This tool uses js-yaml with the YAML 1.2 core schema, where only true and false (in any case, such as True or FALSE) are booleans, so yes, no, on and off stay strings. Older YAML 1.1 parsers, such as PyYAML, turn them into booleans, which is why the country code NO can become false (the "Norway problem"). Quote values like these if other tools will read the file.
When should I use YAML instead of JSON?
Use YAML when people will edit the file (config files, CI/CD pipelines, Kubernetes manifests, Docker Compose), because YAML supports comments and has less bracket and quote clutter. Use JSON for API responses and machine-to-machine data, where strict syntax and fast parsing matter.
What are the most common YAML syntax mistakes?
Indentation with tabs (YAML requires spaces only). Inconsistent indentation depth within the same block. Missing space after colon in key: value pairs. Special characters in unquoted strings (: # { } [ ] , & * ? | - < > = ! % @ ` must be quoted). Duplicate keys (an error in YAML 1.2 and in this tool, though some parsers silently keep the last value). Multiline strings not using the correct | or > block scalar style.
What is the difference between YAML block style and flow style?
Block style uses newlines and indentation (human-readable, multi-line). Flow style uses inline JSON-like syntax with brackets and braces. Example — Block: "name: John\nage: 30". Flow: "{name: John, age: 30}". Both are valid YAML. Block style is preferred in config files; flow style appears in autogenerated YAML.
Is YAML a superset of JSON?
Yes — valid JSON is valid YAML 1.2 (with minor exceptions). YAML 1.2 was specifically designed to make all valid JSON documents also valid YAML documents. This means you can use a YAML parser to read JSON files. The reverse is not true — YAML documents with comments, anchors, or tags are not valid JSON.

Also available as

✓ Copied!