Skip to content
FmtTools

JSON Minifier and Compressor

Remove the whitespace that RFC 8259 calls insignificant, then show the byte delta, prove the round trip and keep every digit of every number intact.

Whitespace only

Space, tab, LF and CR outside strings. String contents are never touched.

gzip comparison unavailable

This browser has no Compression Streams API, so the row is omitted rather than estimated.

JSON to minify

Bytes 323Lines 9

Minified JSON

{"dataset":"e2e-fixture","generated":"2026-11-12T09:14:02Z","records":[{"id":1,"label":"leading zero kept","zip":"00420","amount":12.5},{"id":2,"label":"unsafe integer","zip":"9007199254740993","amount":0.1}],"notes":"Multi-line value:\nsecond line stays inside the string."}
Bytes 275Saved 48 B (14.9%)

Minified and verified

323 bytes → 275 bytes, 48 removed (14.9 percent).

Input bytes
323
Output bytes
275
Whitespace removed
48 B

14.9% of the document

Lines collapsed
9 → 1
Members
12
Depth
4
Duplicate names
0

None

Round trip
identical

Output re-parsed and re-minified

Minification you can verify rather than trust

Minifying correctly is harder than deleting spaces: whitespace inside a string is data. A naive regular expression that strips or collapses \s+ corrupts documents whose values contain line breaks, and it is a classic source of silently mangled templates and multi-line messages. This tool parses first and only removes whitespace that the grammar classifies as insignificant.

The result panel reports input bytes, output bytes, the saving in bytes and percent, and — where the browser exposes the Compression Streams API — the size of both after gzip, because the interesting question is usually "is minifying before gzip still worth it" and the honest answer depends on how repetitive the document is.

Minification is re-parsed and compared structurally against the input. If the two do not agree, the tool says so instead of handing you a smaller file that means something different.

What the minifier reports and preserves

  • Whitespace removal that never touches string contents
  • Byte and percentage savings against the original
  • gzip comparison when the browser supports Compression Streams
  • Numeric literals preserved exactly
  • Duplicate members preserved rather than collapsed
  • Optional escaping of non-ASCII to \u sequences
  • Round-trip verification against the parsed input
  • Line and record counts before and after
  • Download as .json with the byte count in the filename label
  • NDJSON detected and reported instead of silently joined

How to minify JSON

  1. 1Paste the pretty-printed documentIf you received it from the JSON formatter, paste that output directly — the minifier is the inverse pass.
  2. 2Decide on non-ASCII handlingLeaving Unicode raw is smaller for UTF-8 payloads of Latin text; escaping to \u00e9 helps only when the transport cannot carry UTF-8.
  3. 3Read the savings, not just the sizeThe panel shows bytes removed and percent. A document that was 90 percent indentation has nowhere near the same post-gzip gain as one with long repeated strings.
  4. 4Confirm the round tripThe tool re-parses the minified output and compares it to the original tree. If verification fails, the input contained something the grammar does not allow.

Where minification actually pays

Approximate effect of removing whitespace before gzip, by document shape.
Document shapeWhitespace shareAfter gzip, minify still helps?
Deeply nested, short keys, lots of structureHigh — often 40-70%Yes; structural tokens dominate and gzip cannot infer your indentation.
Long repeated string values, log payloadsLowMarginally; gzip already collapses the repetition.
Array of many small recordsHighYes, and the win scales with record count.
Base64 blobs in string fieldsVery lowNo; encoded payloads are near-incompressible and untouched by whitespace removal.

Shares are the ratio of insignificant whitespace in the formatted document, which the size report prints as a number you can check rather than a claim to take on faith.

Frequently asked questions

Does minifying JSON change the data?

Not if it is done correctly. RFC 8259 §2 defines space, tab, LF and CR outside strings as insignificant. Minification becomes corruption the moment a naive implementation removes whitespace inside a string value, which is why this tool parses before it prints.

Should I minify before storing or before sending?

Sending, yes, if you are not already compressing the transport. Storing minified is usually a mistake: you lose readable diffs, and object storage or a database column costs you little per byte compared with the review time you will spend on an unreadable fixture.

Is minified JSON faster to parse?

Marginally, because the parser skips fewer characters, but the difference is dwarfed by allocation for large documents. If parse time is your bottleneck, the fix is a smaller payload or a different encoding, not fewer spaces.

Why is my minified file still large?

Because the size was data, not formatting. Check the whitespace share in the report: a document that shrinks 5 percent had almost no indentation to remove, and the next step is dropping fields or paginating.

Can it un-minify as well?

That is the JSON formatter, in the same column. Both directions operate on the same syntax tree, which is why a format-then-minify round trip is byte-identical to the original minified form.

How do I know minification left the data alone?

The output is re-parsed and compared member by member against the tree built from the input, so equality is proved on the value rather than assumed from the character count — and the number literals that survive are the characters you typed, not a double-precision approximation. The panel shows bytes before and after plus a gzip comparison of both, because whitespace removal is where the win is and re-encoding is where it usually is not.