← Back to the JSON tool

JSON Minifier

Last updated: 26 September 2026

Compress any JSON to its shortest legal form by stripping indentation and line breaks — and see exactly how many bytes that saved. It runs in your browser, so the payload never leaves the machine.

Local compression No upload Byte savings Lossless

What minifying JSON does

A pretty-printed document spends a surprising amount of its length on characters the parser ignores: two-space indents, one property per line, the space after every : and ,. Minifying removes all of it and collapses the file onto a single line. The result is byte-for-byte equivalent as data — JSON.parse returns the identical value before and after — because whitespace between tokens is not part of the information.

The one thing minification never touches is whitespace inside a string. A value such as " keep me " survives intact, since there it is data rather than formatting.

When you want minified JSON

Conversely, leave config files that humans edit and review formatted. The byte saving is irrelevant on disk, and single-line JSON in a diff is unreadable.

How much smaller does it get?

Roughly what the formatting costs you. A document indented two spaces per level with one key per line commonly loses 20–45% of its length; deeply nested payloads with wide indents lose more. Payloads dominated by long strings barely move, because there is almost no formatting in them to remove. The tool reports the real number for your own data rather than an estimate.

Minify from the command line or code

A browser tab is the right tool for pasting one-off payloads. For pipelines, do it where the file already is:

In application code the last two matter more than the file: build the payload with JSON.stringify(value) and it is already minified — the null second argument is what keeps it compact, since JSON.stringify(value, null, 2) is what adds the indentation back.

Minification and compression are different jobs

They stack rather than compete. Minification removes formatting first; gzip or Brotli then compresses what is left, and for anything sent over the wire the transfer encoding is the bigger win — a minified-then-gzipped payload often ends up far smaller than either step alone. Minify anyway when the bytes are stored rather than streamed, because nothing is compressing them for you.

Frequently Asked Questions

What does minifying JSON actually remove?

Only whitespace that is not part of the data: indentation, line breaks and the spaces after commas and colons. Property names, values, array order and the characters inside strings are untouched, so the minified document parses to exactly the same value as the original.

Does minifying JSON change the data?

No. Whitespace between tokens carries no meaning in JSON, so removing it produces an equivalent document. The one thing to remember is that whitespace inside a string is data and is preserved — a value like " hello " keeps its spaces.

How much smaller does JSON get when minified?

Typically 20 to 45 percent for pretty-printed documents, and much more when the input uses wide indentation or one property per line. Data dominated by long strings barely shrinks, because there is little formatting to remove.

Is minified JSON still readable?

Not really — it collapses onto a single line, which is what makes it good for transport and bad for review. Keep readable JSON in version control and minify only at build or request time. This tool is reversible: paste minified JSON into the formatter to pretty-print it again.

Should I minify JSON config files in Git?

Usually no. Humans and code reviewers have to read those files, and the byte saving is irrelevant on disk. Minify what crosses a network or a storage quota, and keep what people edit formatted.

Does minifying replace compression like gzip?

No, the two stack. Minification removes formatting first, then gzip or Brotli compress what is left, and transfer-encoding is normally the far bigger win. Still worth doing when the payload is stored rather than streamed, such as in localStorage or a bundled asset.

Want the other direction? The formatter pretty-prints with an indent width from 1 to 20, sorts keys recursively and shows line numbers. Spotted a bug? Get in touch.