Skip to the JSON editor
JSON Formatter Viewer

JSON minifier

input.json

Paste your JSON here

or drop a .json file anywhere here

Formatted output appears here.

Waiting for input

What gets removed

Minifying re-serialises the document with no separators: the line breaks, the indentation, and the single space conventionally placed after each colon and comma. Everything inside a string literal is data and is left untouched — {"note":"two spaces"} keeps both spaces.

Because it is a parse-and-re-serialise, the output is guaranteed to be valid JSON that encodes the identical value. It is not a text substitution, so it cannot corrupt a string that happens to contain a brace.

When minifying actually matters

Whitespace is the most compressible content there is, so if your transport already applies gzip or brotli, minifying buys very little. It earns its place where compression is absent or where the limit is counted in raw bytes:

  • Size-capped payloads. Queue messages, webhook bodies, and cookie or header values with hard byte ceilings.
  • Database columns. A JSONB or TEXT column storing pretty-printed JSON pays for the indentation on every row, forever.
  • Logs and metrics. Ingestion is usually billed per byte, and structured log lines must be single-line anyway.
  • Embedded and edge contexts. Firmware images, KV stores, and QR codes, where every byte is accounted for.

Conversely, do not minify JSON that a human reads or that lives in version control. A minified file produces one-line diffs that hide what changed, which costs far more than the bytes save.

Checking the saving

The status bar shows the document size after each operation, and size in the statistics row updates on every parse. Format, note the size, then Minify and compare. For a realistic picture of what a user will download, compare the two after compression:

gzip -c data.json     | wc -c   # pretty, compressed
gzip -c data.min.json | wc -c   # minified, compressed

The gap between those two numbers is the real benefit. The gap between the uncompressed files is usually a much larger number that nobody actually pays.

Going the other way

A minified document is valid JSON, so it loads here and expands in thetree viewer without any preparation. To get readable text back, press Format, or start from the beautifier, which is the same operation aimed at the reverse task.

Common questions

How much smaller does minified JSON get?

Typically 10–30 % for two-space-indented documents, and more for deeply nested ones where indentation dominates. The status bar reports the exact byte count after minifying, so you can measure your own payload instead of guessing.

Is minifying worth it if I already use gzip or brotli?

Much less than you would expect. Indentation is extremely repetitive, so compressors handle it almost for free — the compressed difference is often under 2 %. Minify to save on things compression does not cover: uncompressed database columns, size-capped message payloads, and log lines.

Does minifying lose any data?

No. Only whitespace between tokens is removed. Whitespace inside strings is part of the value and is preserved exactly.

Can I minify JSON that has comments in it?

Press Repair first. Comments are not valid JSON, so the document has to be made parseable before it can be re-serialised; Repair strips them along with trailing commas and single quotes.

The rest of the toolkit

Same engine, same privacy — every page runs entirely in your browser.