Skip to content
Toolkit home

JSON Formatter & XML Prettifier

Prettify and validate JSON and XML documents.

Paste raw or minified JSON. Validated as you type.
Valid
Run Beautify or Minify

How the Text & Code Formatter works

JSON is parsed with the browser’s standards-compliant parser and re-serialised with your chosen indentation, so the output is guaranteed to be valid JSON. XML is parsed into a DOM, checked for well-formedness and re-indented node by node.

When parsing fails, the tool reports the line and column of the problem so you can jump straight to the missing comma, quote or closing tag. Everything runs locally and no data leaves your device.

How to use the Text & Code Formatter in 3 steps

  1. Step 1

    Paste or type your JSON or XML into the input editor and choose the format.

  2. Step 2

    Select an indentation size, then format or minify the document.

  3. Step 3

    Fix any error shown at the reported line and column, then copy the result.

Frequently asked questions

Is it safe to paste sensitive JSON into this formatter?

Yes. Formatting happens entirely in your browser with JavaScript; the content is never sent to a server or stored.

Why does my JSON fail to validate?

The most common causes are trailing commas, single quotes instead of double quotes, unquoted keys and comments, none of which are allowed by the JSON standard.

Can I minify JSON as well as prettify it?

Yes. Choose minify to strip all whitespace for smaller payloads, or format to make it readable again.