Tools

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.

All parsing and conversion happen locally in your browser. Your YAML and JSON are never uploaded, stored, or logged.

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.
Important: YAML does not allow tabs for indentation — only spaces. A single tab makes the whole document invalid.

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

  1. Using tabs instead of spaces for indentation — replace every tab with spaces, since YAML forbids tabs.
  2. Inconsistent indentation — keep the same number of spaces at each nesting level throughout the document.
  3. A string containing a colon that is not quoted — wrap values like "12:30" or "http://example.com" in quotes.
  4. Ambiguous booleans — values such as yes, no, on, and off are parsed as true/false; quote them if you mean the literal words.
  5. Special characters in a value without quoting — characters like @, #, and { need the value wrapped in quotes.

Frequently Asked Questions

No. YAML strictly forbids tab characters for indentation — you must use spaces. This is one of the most common causes of "invalid YAML" errors. If your editor inserts tabs, configure it to convert tabs to spaces (usually 2 per level). The formatter on this page always outputs spaces, so running your file through it fixes accidental tabs automatically.

Both introduce multiline strings but handle line breaks differently. The literal block scalar | preserves newlines exactly as written, so each line stays on its own line — ideal for scripts or formatted text. The folded block scalar > joins lines together with spaces, collapsing the block into a single line while treating blank lines as paragraph breaks — useful for long prose you want to wrap in the source but store as one line.

Yes. As of YAML 1.2, every valid JSON document is also a valid YAML document, because YAML's flow syntax uses the same braces, brackets, and quoting rules as JSON. This means you can paste JSON straight into a YAML parser and it will work, and it makes conversion between the two formats reliable — which is exactly what the YAML-to-JSON and JSON-to-YAML tabs on this page do.

YAML parsers interpret a range of words — yes, no, on, off, true, false — as boolean values. So the unquoted scalar yes is read as the boolean true and serialized that way in JSON. If you need the literal string "yes" (for example a country code or an answer field), wrap it in quotes: answer: "yes". Quoting forces the parser to keep it as text instead of converting it to a boolean.