All toolsMenu: every tool
Daytoolz

JSON Formatter

Indent JSON so you can read it, or minify it so it is small, and find out whether it is valid.

JSON Formatter

Result

{ "tool": "json-formatter", "runs_in": "your browser", "uploads": false, "tags": [ "json", "format", "validate" ] }

  • Is it valid JSONYes
  • Size you pasted (bytes)102
  • Size after this (bytes)137
  • Keys at the top level4

Works out in your browser. Nothing you type is sent anywhere.

In short: JSON Formatter

The JSON in the box is Yes as valid JSON. It went in at 102 bytes and came back at 137, holding 4 keys at the top level and nesting 3 levels deep. Formatting changes only the whitespace; the data itself is untouched.

What is JSON?

JSON is a text format for structured data, built from objects, arrays, strings, numbers and three literal values.

How is JSON calculated?

JSON→parse→write with chosen indent

The text is parsed into real values and then written out again with the indentation you chose, which is why an invalid document fails rather than being reformatted. Minifying writes the same values with no whitespace at all.

  • parsereading the text into structured values
  • indentthe spaces or tab used for each level

A worked example

Inputs and results for the worked example
Paste your JSON{"tool":"json-formatter","runs_in":"your browser","uploads":false,"tags":["json","format","validate"]}
ActionFormat and indent
Indent2 spaces
Sort keysNo
Result
Result{ "tool": "json-formatter", "runs_in": "your browser", "uploads": false, "tags": [ "jso...
Is it valid JSONYes
Size you pasted (bytes)102
Size after this (bytes)137
Keys at the top level4

Every figure in this table is produced by the same calculation the tool above runs.

How to use this JSON formatter

  1. Paste the JSON into the box.
  2. Choose whether to format it or to minify it.
  3. Pick the indent, if you are formatting.
  4. Sort the keys if you are comparing two documents.

Questions people ask

Why does my JSON not validate?

The usual causes are a trailing comma after the last item, single quotes instead of double ones, and keys without quotes, none of which JSON allows even though JavaScript does. Comments are not allowed either. The message here says which kind of fault was found.

Does formatting change my data?

No, only the whitespace between the values. Sorting the keys changes their order, which is a change to the document but not to its meaning, since JSON objects are unordered. Numbers are written back in the shortest form that reads back identically.

Why sort the keys?

Because two documents that hold the same data in a different order look completely different to a text comparison. Sorting both makes the real differences visible. The text compare tool is the natural next step.

Is my JSON uploaded anywhere?

No. It is parsed and rewritten inside this page, and nothing is stored or sent. That matters for JSON pasted from an API response, which often holds keys and personal data.

Accuracy and sources

Checked by the Daytoolz team on 16 October 2026. How we check our tools.

All developer tools