Skip to content
ToolZone

JSON Formatter

Beautify minified JSON into a readable, indented structure, or minify it down to a single compact line, with automatic validation along the way.

Runs in your browser. Nothing you enter or upload leaves your device.

Indent

Keyboard shortcuts

Run the main action
⌘ / Ctrl + Enter
Copy the result
⌘ / Ctrl + Shift + Enter
Download the result
⌘ / Ctrl + S
Paste a file or image into file tools
⌘ / Ctrl + V
Search all tools
⌘ / Ctrl + K
Show these shortcuts
?

You can also drop files anywhere on the page.

About the JSON Formatter

The JSON Formatter checks your JSON as you type and rewrites it in place, either pretty-printed with spaces or tabs or minified onto one line, optionally with keys sorted. If the JSON cannot be parsed, the error is shown with its line and column so you can track down the problem.

How it works

When you click Beautify or Minify, the text is parsed with the browser's built-in JSON parser and then serialized again. Beautify uses the indentation selected in the Indent menu; Minify uses none. The formatted result replaces the text in the editor, so you can keep editing it.

Because the JSON is fully parsed and rebuilt, the output is always valid, consistently spaced JSON. Key order is preserved, but if an object has duplicate keys only the last value is kept, and very large integers beyond 2^53 lose precision, as they do in any JavaScript-based tool.

How to use

  1. 1

    Paste your JSON into the editor.

  2. 2

    Choose 2 spaces, 4 spaces or Tab, and tick Sort keys A–Z if you want keys in order.

  3. 3

    Click Beautify to pretty-print, or Minify to compress.

  4. 4

    If an error appears, fix the problem at the reported line and column; the status updates as you type.

  5. 5

    Click Copy JSON or Download to save the result.

Worked examples

Beautify

A compact API response.

Input
{"id":7,"tags":["a","b"],"active":true}
Result
{ "id": 7, "tags": [ "a", "b" ], "active": true }

Minify

Compressing a formatted config.

Input
{ "a": 1, "b": [1, 2] }
Result
{"a":1,"b":[1,2]}

Invalid JSON

A trailing comma.

Input
{"a": 1,}
Result
An error message from the parser, such as "Expected double-quoted property name", with the exact wording depending on your browser.
Limitations
Line and column are shown only when the browser's error message includes a position. Very large files (tens of megabytes) can make the editor slow. Duplicate keys are silently collapsed and integers larger than 2^53 lose precision.
Assumptions
Input follows the JSON standard (RFC 8259), not JSON5 or JSON with comments.
Privacy
Your JSON is parsed and formatted in your browser and is never uploaded.

Frequently asked questions

What is the benefit of minifying JSON?+

It removes whitespace, making the payload smaller for network transfer and letting it fit on one line.

Will this catch syntax errors in my JSON?+

Yes. If parsing fails, the parser's error message is shown in place of the valid status, often with a position that points to the problem.

Does it change my data?+

Values stay the same, and key order too unless you tick Sort keys. Only whitespace changes, except that duplicate keys are reduced to the last one and very large integers may lose precision.

Can it format JSON with comments?+

No. Comments are not valid JSON, so remove them before formatting.

Can I indent with tabs?+

Yes. Pick Tab in the Indent options before clicking Beautify.

Related tools