JSON Minifier
Minify JSON by removing whitespace and comments. See exact byte savings.
What Is JSON Minification?
JSON minification (also called JSON compression or compacting) removes all unnecessary whitespace, newlines, and indentation from a JSON document, producing the smallest valid JSON string possible. The resulting JSON is functionally identical — every key, value, and structure is preserved — it just contains no formatting characters. Minified JSON is the standard format for API responses, config bundles, and any scenario where reducing payload size and parse time matters.
Before & After — What Minification Does
Input (formatted, 4-space indent, 198 bytes):
{
"id": 1,
"name": "Alice",
"role": "admin",
"active": true,
"tags": ["beta", "verified"]
}Output (minified, 67 bytes — 66% smaller):
{"id":1,"name":"Alice","role":"admin","active":true,"tags":["beta","verified"]}How to Minify JSON
- Paste your formatted JSON into the Input pane, or click Upload to load a
.jsonfile. - Optionally paste a public JSON URL into the Fetch from URL bar to load a remote endpoint.
- Click Minify to strip all whitespace and produce a single-line JSON string.
- Enable Live mode to auto-minify as you type (300 ms debounce).
- Toggle Sort keys to alphabetise object keys before minifying — useful for deterministic output.
- Toggle No nulls to remove all
null-value properties before minifying. - Enable JSONC to strip
//and/* */comments before parsing. - Enable Repair to auto-fix trailing commas and strip the UTF-8 BOM.
- Enable Big Int to safely handle 64-bit integers that exceed JavaScript's number precision.
- The Saved badge shows Original size / Minified size / percentage reduction for your specific input.
- Click Download to save the output as
minified.json.
Why Minify JSON?
- Smaller payloads — less data transmitted over HTTP reduces bandwidth costs and speeds up API responses.
- Faster parsing — fewer bytes means the JSON parser does less work, especially on mobile or low-power devices.
- Better caching — smaller files fit more entries in edge caches and CDN layers.
- Security — minification removes developer comments that might accidentally expose internal logic or configuration details.
- Combine with gzip — minification and server-side gzip/brotli compression stack together. Minify first, then let your server compress the result for maximum reduction.
How Much Does Minification Save?
Typical pretty-printed JSON with 2-space indent compresses by 15–35% after minification alone. With 4-space indent the savings are larger — up to 40%. The exact figure depends on nesting depth and string-to-structure ratio. The Saved badge in the header shows the exact percentage for your input. Combine with gzip on the server for another 60–80% reduction on top.
Common Errors When Minifying JSON
- Trailing comma —
{ "a": 1, }is invalid JSON and will fail to parse. Enable Repair to auto-remove trailing commas before minifying. - Single quotes — JSON requires double quotes.
{'key': 'value'}is not valid JSON. - Unquoted keys —
{ name: "Alice" }is JavaScript object syntax, not JSON. Keys must be double-quoted. - Comments — Standard JSON does not allow
//or/* */comments. Enable JSONC mode to strip them before minifying. - Large integers — Numbers larger than 2⁵³−1 lose precision when parsed by
JSON.parse(). Enable Big Int mode to handle 64-bit integers safely.
JSON Minify vs JSON Compress — What's the Difference?
Minification removes whitespace characters (spaces, tabs, newlines) while keeping the JSON fully human-readable and spec-compliant — you can still read and edit the output. Compression (gzip, brotli, deflate) encodes the bytes into a binary format that cannot be read without decompression. Both reduce file size, but they operate at different layers. Apply minification in your build pipeline; apply compression at the HTTP server layer. They are complementary.
Related Tools
- JSON Formatter — pretty-print and beautify JSON for readability
- JSON Validator — validate JSON syntax before minifying
- JSON to CSV — convert JSON arrays to spreadsheet-ready CSV
- JSON to XML — convert JSON to XML format
Is My JSON Sent to a Server?
No. All minification runs entirely in your browser using JavaScript's built-in JSON.parse() and JSON.stringify(). Your JSON data never leaves your machine.