Minify & Beautify

Minify JSON to a single compact line, or beautify it with configurable indentation. Instantly shows size reduction.

Input JSON
Waiting for input…
Indent:

        

What is JSON minification?

JSON minification removes all unnecessary whitespace — spaces, tabs, and newlines — from a JSON string, producing the most compact valid representation. The data is unchanged; only the whitespace that exists for human readability is stripped. Minified JSON is harder to read but faster to transmit and slightly faster to parse because there are fewer characters to process.

This tool works entirely in your browser. It parses your JSON first to validate it, then re-serialises it without indentation using JavaScript's JSON.stringify(parsed). Nothing is uploaded to any server.

When should you minify JSON?

  • API responses in production — minifying the JSON your API returns reduces response payload size and improves latency, especially on mobile networks.
  • Embedding JSON in code — inline JSON in HTML, JavaScript files, or environment variables should be compact to avoid unnecessary file size increases.
  • Storing JSON in databases — when storing JSON in a database column (e.g. PostgreSQL's json or jsonb type), minified input is smaller on disk.
  • HTTP request bodies — minifying the request body in POST/PUT API calls slightly reduces upload size, which matters in high-throughput scenarios.
  • Caching payloads — JSON stored in a cache (Redis, Memcached) takes less memory when minified.

How much smaller does minified JSON get?

The size reduction depends on how much whitespace was in the original. For tightly written JSON with short key names and 2-space indentation, minification typically saves 15–25% of the byte count. For JSON with 4-space indentation and long arrays, savings can reach 30–40%. The stats bar after minification shows the original size, minified size, and the exact percentage saved.

Minify vs Beautify — when to use each

Use Minify when you are preparing JSON for transmission, storage, or embedding in code where size matters. Use Beautify when you need to read, review, document, or debug JSON. In most workflows, JSON lives in a beautified form during development (in config files, test fixtures, documentation) and a minified form at runtime (in API responses, caches, request bodies). This tool supports both in one place.

Minification does not compress JSON

Minification and compression are different. Minification removes whitespace, reducing size by 15–40%. Compression algorithms like gzip or Brotli apply further entropy-based encoding, typically reducing the minified JSON by another 60–80%. HTTP servers automatically gzip responses and browsers automatically decompress them, so for API responses both minification and gzip compression are usually applied. For maximum efficiency, minify first then let your web server handle gzip/Brotli compression.

Frequently asked questions

No. Minification only removes whitespace characters (spaces, tabs, and newlines) from outside string values. The keys, values, structure, and all content inside strings remain completely unchanged. A JSON parser produces identical output from minified and beautified versions of the same data.

Yes. This tool uses JSON.parse() followed by JSON.stringify(), which preserves insertion order for object keys in all modern JavaScript engines (V8, SpiderMonkey, JavaScriptCore). The key order in the minified output will match the order in the input.

Press Ctrl + M (or Cmd + M on Mac) to run the Minify operation. Press Ctrl + B (or Cmd + B) to run Beautify.

No. All processing happens in your browser using native JavaScript. Your JSON never leaves your device.