JSON Minifier
Compress and minify JSON to reduce file size with byte savings stats
Shortcuts: Ctrl+Enter run · Ctrl+L clear · Ctrl+D download
About JSON Minifier
A JSON minifier strips all whitespace, indentation, and newlines from a JSON document, producing the smallest possible representation of the same data. Smaller JSON payloads speed up API responses, reduce bandwidth costs, and shorten load times — particularly important in mobile apps and high-traffic services. This tool shows you the exact byte savings so you can see the impact at a glance.
- ✓Displays input size, output size, and percentage reduction side by side
- ✓Handles deeply nested objects and large arrays without size limits
- ✓One-click copy and download of the minified output
- ✓Instant results — no server round-trip needed
Why JSON Size Still Matters
It is tempting to assume that compression (gzip, Brotli) makes manual minification pointless — "the server compresses it anyway, right?" In practice, minification and compression solve overlapping but distinct problems, and skipping minification leaves real savings on the table.
Minification vs. compression — they stack
- ·Compression (gzip/Brotli) finds repeated byte patterns across the whole payload, including whitespace — so it does recover much of the size lost to formatting
- ·However, compression has CPU cost on both ends, and not every transport applies it — internal service-to-service calls, cached static JSON files, and embedded data blobs often go uncompressed
- ·Minifying before compressing still produces a smaller final payload than compressing formatted JSON, because there is simply less redundant structure for the compressor to encode in the first place
Tip: If you control both ends of a high-volume API, measure the actual byte counts for your real payloads — minified+compressed vs. formatted+compressed — rather than assuming compression alone is "good enough". The difference is often a few percent, but at scale a few percent of bandwidth is real money.
Where minification has the biggest payoff
- ·Static JSON bundled with a web or mobile app — every byte is downloaded by every user on every install/update, so trimming it shrinks your app's footprint directly
- ·Data embedded inline in HTML or JavaScript (e.g., `<script>window.__DATA__ = {...}</script>`) — this ships uncompressed as part of the page source in many setups
- ·High-frequency API responses at scale — shaving even a few percent off a payload that is served millions of times per day adds up quickly in bandwidth costs
- ·Configuration blobs stored in databases or caches — smaller stored values mean less memory pressure and faster reads
Minifying programmatically
// JavaScript — round-trip through parse/stringify strips all whitespace
const minified = JSON.stringify(JSON.parse(formattedJson))
// Python
import json
minified = json.dumps(json.loads(formatted_json), separators=(',', ':'))Note the Python `separators` argument — without it, `json.dumps` inserts a space after each comma and colon by default, which is a common surprise when someone expects fully minified output.
When not to minify
- ·Source-controlled config files — minified JSON produces unreadable diffs in pull requests and makes manual edits painful; keep these formatted and let your build process minify a copy if needed
- ·Anything a human will read or edit directly — documentation examples, fixtures, and files developers open in an editor should stay formatted for readability