JSON Minifier Online
Compress JSON to a single line by removing all unnecessary whitespace, preserving the data exactly. Across 799 real-world documents the median saving is 36.1% of raw bytes — and 11.6% once your server is already gzipping. Both numbers are measured; see below.
Minified JSON will appear here
What is JSON minification?
JSON minification is the process of removing all unnecessary whitespace from a JSON document to produce the smallest valid representation of the same data. Where pretty-printed JSON uses indentation, line breaks, and spaces for readability, minified JSON squeezes everything onto a single line with no whitespace at all.
The data itself is unchanged — every key, value, type, and structural element is preserved exactly. Minification is purely cosmetic: it strips characters that don't affect parsing. A JSON parser produces the same in-memory result whether it reads minified or pretty-printed input.
So why bother? Because whitespace adds up. A typical pretty-printed JSON with 2-space indentation is 40-60% larger than its minified equivalent. With 4-space or tab indentation, the difference is even bigger. For API responses sent thousands or millions of times per day, that translates to real bandwidth, real latency, and real money.
How to minify JSON online
Three steps:
- Paste your JSON into the input panel — formatted or already minified, either works. You can also upload a
.jsonfile or drag and drop one. - Click Minify. The output appears immediately in the right panel as a single compact line.
- Copy or download the minified result. The status message shows exactly how many bytes you saved.
The tool also works in reverse — click Expand to convert minified JSON back to pretty-printed form. Use this when you receive a minified API response and want to read it.
When should you minify JSON?
Minification helps in any context where JSON is transmitted, stored, or transferred in volume:
API API responses
Production APIs almost always return minified JSON. With responses going out thousands of times per second, removing 50% of the bytes meaningfully reduces server bandwidth costs and improves response time.
DB Database storage
If you store JSON in a database column (PostgreSQL jsonb, MySQL JSON, MongoDB), minification reduces storage size, speeds up reads, and reduces network transfer between database and application.
URL Query parameters
JSON embedded in URLs needs to fit in the URL length limit (typically 2048 chars). Minify first, then URL-encode, to stay under the limit and keep URLs reasonably short.
MQ Message queues
Kafka, RabbitMQ, AWS SQS, and similar systems often charge by message size. Minified JSON reduces per-message cost and lets you fit more data inside fixed message limits.
JS Frontend bundles
JSON configs embedded in webpack/Vite bundles add directly to your JS bundle size, which slows page load. Minified configs shrink the bundle.
↻ Webhook payloads
Stripe, GitHub, Slack, and other webhook providers often have payload size limits (256 KB typical). Minification fits more data into a single hook.
How much does minification actually save?
The savings depend on your indentation style and how deeply nested your data is:
- 2-space indent → minified: roughly 30-40% size reduction. This is the most common starting point.
- 4-space indent → minified: roughly 50-60% reduction. Tab indentation falls in this range too.
- Deeply nested structures save more. Each level of nesting adds more whitespace per byte of actual data, so trees with depth 10+ can save 70%+.
- Compression on top of minification helps further. If you serve JSON with gzip or brotli enabled (which you should), minified JSON compresses to roughly the same size as pretty-printed JSON — both are dominated by the repeated key strings. But minification is still a win because (1) it's smaller pre-compression, reducing memory use on the server, and (2) clients without compression support get the smaller payload directly.
When NOT to minify JSON
Some scenarios where pretty-printed JSON is the better choice:
- Configuration files in source control.
package.json,tsconfig.json,.eslintrc.json— keep these pretty-printed so git diffs show meaningful changes rather than "the whole file changed". - Documentation and examples. JSON shown in API docs or tutorials should be pretty-printed for readability.
- Logs and audit trails. Human-readable formatting helps when you're scanning logs by eye, though tooling like
jqcan reformat on demand. - Small files where the savings are negligible. A 200-byte config file doesn't benefit meaningfully from minification.
- Debug environments. During development, pretty-printed responses from your own API are easier to inspect in browser DevTools.
The rule of thumb: minify for production transmission and storage; keep it pretty for development, source control, and documentation.
FAQ — Json Minifier
jq -c . file.json > file.min.json — that's the canonical way to minify large JSON outside a browser.customer_billing_address_line_1 to addr1)? (3) should you compress with gzip/brotli on top?How much does minifying actually save?
Most minifier pages quote a raw-byte figure and stop there. That number is real, but almost every JSON response is served over a compressed connection, and compression already removes most of what minifying removes. Both numbers below come from running the same 799 real-world JSON documents through every combination.
| Comparison | Median saving | Range |
|---|---|---|
| Minifying, uncompressed bytes | 36.1% | 2.3% – 70.6% |
| Minifying, when gzip is already on | 11.6% | 0.7% – 58.2% |
| gzip alone, on the formatted file | 82.8% | — |
| Switching gzip → brotli, already minified | 17.8% | — |
Read that as: minifying is worth doing, and it is not the big lever. Compression is. If you are shipping JSON uncompressed, turning compression on is worth roughly seven times more than minifying, and switching from gzip to brotli is worth more than minifying on top of gzip.
Where minifying still matters plainly: storage and log volume, embedding JSON in a URL or a database column, anything not served over HTTP, and the 58.2%-saving tail — deeply indented documents with short values, where whitespace is a large share of the content even after compression.
799 documents from the SchemaStore catalogue, 2 KB to 2 MB. gzip level 6, brotli at default quality. Full write-up →
Everything on this page runs in your browser — no upload, no server-side processing. How it works →