JSON Minifier

Compress JSON by removing all whitespace. Shows exact bytes saved.

Input JSON
1
Minified JSON
Output appears here…
2sp · UTF-8

What is JSON Minification?

JSON minification removes all unnecessary whitespace — spaces, tabs and newlines — from a JSON document without changing its data. The result is a single-line JSON string that takes fewer bytes to store and transmit.

Example

Before (79 bytes):

{
  "user": {
    "id": 1,
    "name": "Ravi Mehta",
    "city": "Surat"
  }
}

After minification (47 bytes — 40% smaller):

{"user":{"id":1,"name":"Ravi Mehta","city":"Surat"}}

Both represent exactly the same data. Only whitespace is removed.

When to Minify JSON

  • Production API responsesEvery extra space is wasted bandwidth multiplied across thousands of requests
  • Embedding in HTMLMinified JSON in script tags reduces page weight directly
  • Database storageStoring in a TEXT column — fewer bytes means lower storage cost
  • Configuration deploymentMinify before deploying large JSON config files to production servers

Do not minify JSON files that developers edit by hand. Readability is worth the extra bytes for config files.

Minify JSON in Code

JavaScript:

js
// One line — parse then re-stringify without indent
const minified = JSON.stringify(JSON.parse(formatted));

Python:

python
import json
minified = json.dumps(json.loads(formatted), separators=(",", ":"))

Node.js (file to file):

js
const fs = require("fs");
const data = JSON.parse(fs.readFileSync("input.json", "utf8"));
fs.writeFileSync("output.min.json", JSON.stringify(data));

Minify vs Compress

Minification and compression (gzip, brotli) are two different things. Minification removes whitespace at the text level. Compression works at the binary level and is applied by the web server. For maximum savings, use both — minify your JSON first, then let your server apply gzip. Minified JSON compresses better because it has less repetition.

Frequently Asked Questions

Typically 20–40% for a formatted API response. Deeply nested JSON with 4-space indentation can save up to 50%. JSONKit shows the exact input size, output size and percentage saved.

No. Only whitespace (spaces, tabs, newlines) is removed. The actual keys, values and structure are identical to the original.

Yes — use the Beautify button to reformat the minified output back to readable JSON at any time.

Slightly, because the parser processes fewer characters. The real saving is in network transfer time, not parsing time.

Related Tools