Skip to content

JSON Minifier

Strip whitespace from JSON and see how many bytes you saved.

LOCAL WORKSPACENO UPLOAD REQUIRED

Minified JSON

The compact version appears here.

About JSON Minifier

Minifying JSON removes indentation, newlines and spaces between tokens. It keeps spaces inside strings. Savings depend on the original layout; already compact input may save nothing.

The tool shows the before and after size along with the percentage saved, so you can judge whether the trade-off in readability is worth it for your use case.

How JSON Minifier works in your browser

After syntax validation, source tokens are joined without insignificant whitespace. Large integers, duplicate members, numeric notation and escaped strings remain unchanged. For example, 9007199254740993 is not rounded to 9007199254740992. Comments and trailing commas remain invalid JSON.

The before and after byte counts are shown with the percentage saved. Minification complements gzip or brotli compression rather than replacing it.

When to use it

  • Shrinking a JSON fixture or config before embedding it.
  • Measuring how much whitespace a pretty-printed payload is carrying.
  • Producing a single-line JSON value to paste into an environment variable.

Worked examples

Remove layout, not spaces inside values

Settings: Paste valid JSON; output updates automatically

Input

{
  "message": "hello  world",
  "count": 2
}

Expected output

{"message":"hello  world","count":2}

The two spaces inside the message are data and remain. Indentation, newlines and spaces between JSON tokens disappear. Before and After measure UTF-8 bytes, not character count or compressed transfer size.

Keep large integers exactly as written

Settings: Paste valid JSON

Input

{ "id": 9007199254740993, "n": 1e+3, "n": -0 }

Expected output

{"id":9007199254740993,"n":1e+3,"n":-0}

The source-token formatter preserves number spelling and duplicate members instead of serializing a parsed object. A downstream parser can still round a large number or keep only the last duplicate member.

Limits and checks before you use the result

  • Comments, trailing commas, single-quoted strings and unquoted keys are not JSON. Invalid input shows an error instead of being repaired or silently discarded.
  • Minification is not gzip or Brotli compression. Already compact JSON may save no bytes; actual network savings depend on server compression too.
  • The browser holds input and output in memory. Large or deeply nested documents can be slow. Use a local command-line processor for files too large for a tab.

Frequently asked questions

Is minified JSON still valid?

Yes. Whitespace between tokens carries no meaning in JSON, so removing it produces an equivalent document.

Does it compress the data?

It only removes insignificant whitespace. For real compression, serve the response with gzip or brotli on top of the minified payload.

Are keys shortened?

No. Renaming keys would change the meaning of the document, so the minifier never touches them.

Related tools