DataToolsLab
JSON Tools

JSON Minifier

Strip whitespace from JSON to produce the smallest payload.

Loading tool…

What is JSON Minifier?

The JSON Minifier is the inverse of the JSON Formatter: it collapses indentation, line breaks, and extra whitespace into a single compact line, ready for production payloads, embedding in config files, or transport over the wire.

How it works

We parse the input with our recursive-descent tokenizer so any syntactic error is reported with line and column. On success we re-emit the value with JSON.stringify using no indentation or any whitespace at all.

  1. Paste or drop JSON. Drop a .json file or paste text. Re-minification happens on every keystroke.
  2. Read the byte counts. The input and output byte sizes are shown side-by-side so you can see exactly how much space you saved.
  3. Copy or download. Copy the minified output to the clipboard or download as a .json file.

Examples

Two-line input

{ "a": 1,\n "b": 2 } is minified to {"a":1,"b":2} (39% smaller in this example).

Sort keys option

When sort-keys is on, you get deterministic minified output as well — ideal for byte-identical deploys.

Common mistakes

Trying to parse JSON5

Strict JSON only. Comments, trailing commas and single quotes break minification — fix them first or use a JSONC tool.

Confusing minify with gzip

Minification removes whitespace; it does NOT compress repeated keys or values. Use a real compression tool (gzip) for that.

Alternatives

JSON Formatter

The inverse — turns minified JSON back into readable, indented output.

JSON Validator

If minify fails, jump to the Validator to find the offending character.

Frequently asked questions

How much can I save with minification?

Typical savings range from 20–50% depending on how heavily the original was indented.

Is it safe?

Yes. Minification is local; your JSON never leaves the browser.

Does it preserve key order?

By default yes. Toggle sort-keys to enforce alphabetical order across all objects.

Online