Mode
Indent
Input
Result
Results appear as you typeShortcut: Ctrl + Enter to run

How to use the YAML Formatter

  1. Pick a mode: "Format YAML", "YAML → JSON" or "JSON → YAML".
  2. Paste your content on the left, or press "Sample" to load a Docker Compose example.
  3. The result appears on the right; on a syntax error the status bar shows the line and column.
  4. Press "Copy" or "Download" to get the result.

Examples

YAML to JSON

Input
services:
  web:
    image: nginx:1.27
    ports:
      - "80:80"
Output
{
  "services": {
    "web": {
      "image": "nginx:1.27",
      "ports": [
        "80:80"
      ]
    }
  }
}

Most common YAML mistakes

  • Tabs for indentation: YAML only accepts spaces; a tab is an error.
  • Inconsistent indentation: keys at the same level must line up — one space more or less changes the structure.
  • No space after the colon: key:value becomes a string; write key: value.
  • Unquoted special characters: quote values that start with *, & or @, or contain : .
  • yes / no / on / off: YAML 1.1 parsers read these as booleans; quote them to keep strings.

Specs & key facts

SpecYAML 1.2 (powered by js-yaml 4.3)
ModesFormat YAML, YAML → JSON, JSON → YAML
Indentation2 or 4 spaces
ErrorsLine and column of the error
ProcessingIn your browser (nothing is uploaded)
PriceFree, no sign-up

FAQ

What is the difference between YAML and JSON?

YAML uses indentation and supports comments, which makes it pleasant for hand-edited config files; JSON uses braces and brackets with strict syntax, which suits data exchange between programs. YAML 1.2 is a superset of JSON, so every valid JSON document is valid YAML.

Are comments kept after conversion?

No. Comments are not part of the data, so they are dropped when converting or reformatting.

Can it validate Kubernetes or Docker Compose files?

It validates YAML syntax, but it does not check whether Kubernetes or Compose field names and values follow their schemas.

What about files with multiple documents (---)?

Only the first document is processed. Paste multiple documents separately.