Free Tools Grid

YAML Formatter

Developer Tools

Format and validate YAML in your browser. Optionally convert the parsed data to JSON. Syntax errors point at the line and column of the first problem.

Runs entirely in your browser
Loading tool...

About YAML Formatter

YAML is everywhere developers don't expect it to be: Kubernetes manifests, GitHub Actions workflows, Docker Compose files, Ansible playbooks, OpenAPI specs, dotfiles. It's also notoriously easy to mis-write because of its whitespace sensitivity, surprising quoting rules (Norway problem, anyone?), and three different ways to write multi-line strings. A formatter + validator catches those mistakes the moment you paste in a draft.

This tool uses `js-yaml`, the same YAML parser used inside many production tools. Paste any YAML, get back a cleanly-indented version with consistent quoting, or convert the parsed structure to JSON if a downstream tool needs that format. Errors include the exact line and column of the first problem so you can fix it in place. Everything happens in your browser — your manifests and secrets never reach a server.

How to use

  1. 1

    Paste your YAML

    Drop your YAML into the left editor. Validation runs live as you type.

  2. 2

    Pick an indent

    Choose 2 or 4 spaces from the Indent dropdown.

  3. 3

    (Optional) Convert to JSON

    Switch the Output dropdown to JSON to get the same data structure in JSON syntax. Useful when feeding YAML config into JSON-only tools.

  4. 4

    Copy or download the result

    Use Copy or Download (.yaml / .json) to take the output elsewhere.

Examples

Beautifying inconsistent indentation

Mixed 2-space and 4-space indentation gets normalized to your chosen style.

Input

service:
   name: api
       port: 8080

Output

service:
  name: api
  port: 8080

YAML → JSON for downstream tools

The same data structure rendered as JSON.

Input

name: my-app
version: 1
features:
  - auth
  - billing

Output

{
  "name": "my-app",
  "version": 1,
  "features": [
    "auth",
    "billing"
  ]
}

Frequently asked questions

What YAML version does this support?+

YAML 1.2 (the current spec), which is what `js-yaml` implements by default. Older 1.1 features (octal numbers as `010`, on/off as booleans) are not parsed the same way — that's actually the source of the famous Norway problem (no → false) and is a feature, not a bug.

Why is my value being parsed as a different type?+

YAML aggressively coerces unquoted scalars: `yes` becomes true, `1.0` becomes a number, `2024-01-01` becomes a date. To force a string, wrap the value in quotes: `version: "1.0"` not `version: 1.0`. The formatter preserves this distinction.

Does it support anchors and aliases?+

Yes for parsing — `&anchor` and `*anchor` references are resolved during parse. For output, the formatter expands aliases by default (with `noRefs: true`) to make the result self-contained. If you need to preserve aliases in output, use `js-yaml` directly with `noRefs: false`.

How are multi-line strings handled?+

YAML has multiple multi-line string styles: literal (`|`), folded (`>`), and double-quoted with `\n`. The parser handles all of them; the formatter outputs a sensible default. If you have a specific style preference (e.g. preserve `|` blocks), the round-trip is best-effort.

Is the validator strict about indentation?+

It follows the YAML spec — indentation matters. Two siblings must have the same indentation; a child must be indented more than its parent. Tabs are not allowed (use spaces). If you see a parse error, indentation is the first thing to check.

Is my YAML uploaded?+

No. Parsing happens in your browser via `js-yaml`. Manifests with secrets, internal config, or anything sensitive stays on your machine.