Pretty Printer for JSON, XML & YAML

Format and indent minified or messy JSON, XML, or YAML with auto format detection and adjustable indentation. Runs entirely in your browser.

Formatted (JSON)

{
  "name": "Scout",
  "tags": [
    "a",
    "b"
  ],
  "meta": {
    "active": true,
    "count": 3
  }
}

About this tool

Minified or sloppily-formatted data is hard to read; this pretty printer re-indents JSON, XML, and YAML into a clean, consistent block layout. It auto-detects which of the three you pasted (you can also force a format) and lets you choose two- or four-space indentation. JSON is re-serialized through the native parser, so the output is guaranteed valid and structurally identical to the input. XML is parsed with the browser's XML parser and re-emitted with each element on its own indented line, collapsing self-closing empties and trimming insignificant text whitespace. YAML is parsed (covering the common subset of maps, lists, and scalars) and re-emitted in a normalized block style, which is handy for tidying inconsistent indentation. It is the inverse of a minifier — useful for inspecting an API response, diffing two payloads on equal footing, or making a config readable before editing. Everything runs locally, so your data never leaves the browser.

How to use it

  • Paste JSON, XML, or YAML.
  • Leave format on Auto-detect, or pick one explicitly.
  • Choose your indentation width.
  • Copy the cleanly formatted output.

Frequently asked questions

How does auto-detection work?
It looks at the first non-space character — { or [ means JSON, < means XML — and falls back to trying a JSON parse, otherwise treats the input as YAML. You can override the choice with the format selector if a document is ambiguous.
Is the formatted JSON guaranteed valid?
Yes. JSON is parsed and re-serialized by the browser's native JSON engine, so invalid JSON produces a clear error rather than malformed output, and valid JSON round-trips with identical data.
What YAML features are supported?
The common subset: indentation-based maps, "- " sequences, and scalar values (strings, numbers, booleans, null). Anchors, multi-line block scalars, and flow collections are not parsed, so very advanced YAML may not round-trip — use it for everyday config files.
Does pretty-printing change my data?
No — only the whitespace and layout change. Keys, values, and structure are preserved. For XML, insignificant whitespace between elements is normalized, but element content and attributes are kept.
Can it reformat minified input?
Yes, that is a primary use. Paste a single-line minified JSON or XML blob and it expands into a readable, indented tree. It is the exact inverse of the JSON/CSS/HTML minifiers.
Is my data uploaded?
No. Parsing and formatting run entirely in your browser with no network request.

Related tools