JSON Minifier

Strip every byte of layout whitespace from JSON without changing a single value: exact digits, escape sequences and even duplicate keys survive untouched. Validates as it minifies, entirely in your browser.

0 chars · 0 bytes
Waiting for JSON

Tip: press Ctrl+Enter (Cmd+Enter on Mac) in the editor to format. Drop a .json file anywhere on the editor to open it.

Loading...

Private by design: your JSON never leaves the browser. No upload, no server, no logging.

Minification that is provably lossless

Minifying JSON should be the safest operation there is: whitespace between tokens carries no meaning, so removing it cannot change the document. In practice many minifiers take a shortcut through JSON.parse() and JSON.stringify(), which quietly rounds a 17-digit ID, keeps only the last of two duplicate keys, and turns 1e3 into 1000. This tool removes whitespace from the original token stream instead, so the minified output contains exactly the tokens you pasted. Paste the result back in and format it, and every value round-trips identically.

Validation runs first, with exact line and column errors when the document does not parse, and warnings for duplicate keys and JavaScript-unsafe numbers when it does. Copy the result or download it; if you opened a file, the download keeps its name with a .min.json suffix.

Where minified JSON pays off

API responses are the obvious case, but the same discipline helps anywhere size is metered or parsed repeatedly: JSON embedded in script tags, localization bundles, cached documents in KV stores, and WordPress REST payloads. Combine minification with gzip or brotli at the server; they stack, since compression removes redundancy and minification removes bytes that would otherwise need compressing at all.

JSON minification FAQ

How much smaller does minified JSON get?

Pretty-printed JSON is typically 20 to 40 percent whitespace, so minifying removes that outright. The deeper the nesting and the shorter the values, the bigger the win, because indentation grows with depth. After gzip or brotli the gap narrows since whitespace compresses well, but minified payloads still parse faster, ship fewer bytes on cold caches, and avoid wasting CDN storage, which is why production APIs serve minified JSON.

Is minifying JSON always safe?

Only if the minifier is lossless. JSON defines whitespace between tokens as meaningless, so removing it never changes the document. The danger is minifiers that parse into JavaScript values and re-serialize: those round integers beyond 9007199254740991, drop duplicate keys and rewrite number formats. This minifier removes whitespace from the token stream directly, so every value comes out byte-for-byte identical, and anything risky in the document is flagged as a warning instead.

Does whitespace inside strings get removed?

No. Minification only touches whitespace between tokens: spaces, tabs and newlines used for layout. Whitespace inside string values is data and is preserved exactly, including escaped forms like \n and \t. If your strings look different after minifying with some other tool, that tool was rewriting escape sequences, which this one never does.

Should I minify JSON config files?

Usually not. Config files live in version control and get read by humans, so pretty-printed two-space indentation with sorted keys serves them better: readable diffs and deterministic ordering. Minify what machines consume at runtime: API responses, payloads embedded in HTML, cached documents and anything metered by size. The Format button above switches back to readable output whenever you need to inspect what you minified.

Is my JSON uploaded when I minify it?

No. Minification runs as JavaScript in your own browser tab: nothing is uploaded, stored or logged, and the page works offline once loaded. Documents up to 25 MB are supported; beyond that the tool refuses rather than freeze the tab, and a streaming command-line tool like jq is the right choice.