JSON Minifier — Strip Whitespace and Compress JSON Online
FreeMinify JSON by removing all unnecessary whitespace. Reduces API response size by 20–40%. Validates before minifying. Free, browser-based, no upload.
What's next
Settings guide
Options:
- ·Remove whitespace only (default) — Strips spaces, tabs, and newlines between tokens. Guaranteed-valid output parseable by any compliant JSON parser. No data is modified.
- ·Sort keys alphabetically — Sorts object keys in addition to stripping whitespace. Use for deterministic output when hashing or diffing two JSON documents. Note: JSON spec makes no guarantee on key order, so only use this when consumers ignore insertion order.
How much will it reduce my JSON?
The reduction depends on how much whitespace is in your formatted JSON:
- ·2-space indented, shallow nesting: ~20–25% reduction
- ·4-space indented, deep nesting: ~35–45% reduction
- ·Already compact JSON: minimal or no reduction
Format comparison
Minification vs gzip compression: HTTP gzip compression (applied at the transport layer) reduces JSON by 60–80% regardless of whitespace. If your server already sends gzip responses, JSON minification gives a smaller additional benefit. Minification still helps for in-memory size after decompression, and for environments where gzip is unavailable (some CDN edge functions, certain mobile contexts).
Minified JSON vs shorter key names: Minification removes whitespace only — it cannot shorten key names the way a JavaScript minifier shortens variable names. If you need to reduce JSON size beyond whitespace, the next step is redesigning the schema: shorter keys, numeric codes instead of enum strings, or a binary format like MessagePack.
How it works
Validate first
The input is parsed as JSON before minification begins. If any syntax error exists, it is reported and minification does not proceed — minifying invalid JSON produces invalid compact JSON.
Calculate savings
Original byte size is measured and projected output size is shown so you can see the exact reduction before copying.
Strip whitespace
All insignificant whitespace — spaces between tokens, indentation characters, and newlines — is removed. Whitespace inside string values is preserved exactly.
Copy to target
The output is a single-line JSON document. Paste it into your API response handler, JavaScript bundle, database field, or config file. It reformats identically when passed through any JSON formatter.
About this format
Pretty-printed JSON with 4-space indentation is 20–40% larger than its minified equivalent. For JSON served in API responses, bundled into JavaScript builds, or stored at high volume in a database, that overhead compounds. Minification strips every non-significant space, tab, and newline — producing the smallest valid JSON representation of the same data.
A 100KB formatted API response typically minifies to 60–80KB. Across thousands of daily requests, that is meaningful bandwidth and latency reduction without changing a single data value.
The minifier validates syntax before processing. If the input JSON is invalid, the error is reported first — minifying broken JSON produces broken minified JSON.