Minify & Compress
JSON Online Free
Strip all whitespace from JSON in one click. Reduce payload size for APIs, storage, and transmission — instantly, with no signup and no server involved.
Minify JSON NowShrink Payloads
Remove every byte of whitespace — spaces, tabs, newlines — to produce the smallest valid JSON.
Validates First
JSON is parsed before minifying, so you'll never get a broken compact output from invalid input.
Reversible
Switch back to formatted view any time — beautify and minify are both one click away.
Everything you need to shrink your JSON
Your data never leaves your device
Secure by architecture, not by policy
- No backend server — there is nowhere for your data to go
- No WebSocket, no fetch, no XHR for your JSON content
- Minification runs entirely in your browser — zero network requests
- No account, no login, no cookies tied to you
- Works fully offline after the initial page load
Related JSON tools
Common questions answered
Is the JSON minifier free?
Yes, free with no signup.
How much does JSON minification reduce file size?
Removing whitespace typically reduces JSON size by 20–60% depending on indentation and content.
Is minified JSON still valid JSON?
Yes. Minification only removes whitespace characters — the data structure and values are unchanged.
Does minification work offline?
Yes, all processing is local in your browser.
Can I minify large JSON files?
Yes, the minifier handles large files efficiently using the built-in browser parser.
What is JSON minification?
JSON minification removes all unnecessary whitespace — spaces, tabs, and line breaks that exist purely for human readability. The result is a single-line string with the same data in the smallest valid representation. Minified JSON is standard practice for API payloads, configuration storage, and anywhere bandwidth or storage matters.
Minification can significantly reduce JSON size. A formatted 10 KB configuration file might shrink to 4 KB after minification — a 60% reduction. This adds up in APIs handling thousands of requests per second. This tool minifies instantly in your browser without uploading data, making it safe for production credentials and sensitive payloads.
{
"name": "Alice",
"age": 30,
"roles": [
"admin",
"editor"
]
}
{"name":"Alice","age":30,"roles":["admin","editor"]}
Get the most out of this tool
- Minify JSON payloads before storing them in databases — it reduces storage costs and improves read performance.
- Compare file sizes before and after minification to measure the whitespace overhead in your configuration files.
- Always validate before minifying — minifying invalid JSON just produces a smaller broken string.
Ready to compress your JSON?
Free forever. No signup. Instant results. Works offline.
Open JSON MinifierWhy minify JSON and how it works
JSON minification removes all whitespace characters — spaces, tabs, newlines, and carriage returns — that are not inside string values. The resulting JSON is semantically identical to the original but occupies significantly less space. For a typical formatted JSON document with 2-space indentation, minification reduces file size by 20–40%. For deeply nested documents with many levels, the reduction can exceed 50%.
The minification process requires a full JSON lexer rather than a simple regular expression. A naive approach of removing all whitespace would corrupt string values that intentionally contain spaces or newlines. The correct approach tokenizes the JSON character by character, strips whitespace between tokens, and preserves whitespace within string token boundaries. This tool uses the same Lexer → AST pipeline as the formatter, guaranteeing that the minified output is valid JSON equivalent to the input.
HTTP payload size directly affects API latency. Every byte transmitted over the network takes time, especially on mobile connections where bandwidth is constrained. For an API endpoint called thousands of times per second, reducing response size by 30% can meaningfully reduce bandwidth costs and improve Time to First Byte (TTFB) metrics. Many production APIs minify JSON responses by default for exactly this reason.
Gzip and Brotli compression algorithms, used by every modern web server, are highly effective on JSON because JSON has many repeated patterns (keys appear many times across array elements). After gzip, a minified JSON and its pretty-printed version often compress to nearly the same size — the compression algorithm re-adds the predictable whitespace patterns efficiently. This means minification provides the most benefit for environments where content encoding is disabled or where you measure raw byte count (like localStorage quotas or Cloudflare Worker limits).
localStorage has a 5MB limit in most browsers. If you store large JSON structures client-side (caches, user preferences, offline data), minification is an easy way to fit more data within the quota. Similarly, Cloudflare Workers have a 128KB script size limit and a 128KB KV value size limit — minifying embedded JSON configuration objects can make the difference between fitting and not fitting.
Minified JSON is also used for embedding in HTML. When you include JSON-LD structured data for SEO or pass initial data to a JavaScript framework via a <script> tag, minified JSON reduces the bytes the browser must parse before the page is interactive. Google's PageSpeed Insights rewards smaller initial document sizes, making JSON minification relevant for Core Web Vitals scores.
When developers use this tool
Things to know before minifying
- Minification is reversible: A minified JSON document can always be reformatted to pretty-printed form. If you need to debug minified production JSON, paste it into the formatter tab to restore indentation and structure.
- String whitespace is preserved: Spaces and newlines inside string values are never removed. If a field value is "Hello, world" with a space, the space remains in the minified output. Only inter-token whitespace is stripped.
- Gzip often eliminates the size benefit: If your server sends gzip-encoded responses, the size difference between formatted and minified JSON after compression is typically under 5%. Minification still helps for uncached edge cases and environments without compression.
- Don't minify JSON you need to read: Log files, configuration files, and other developer-facing JSON should stay formatted. Reserve minification for machine-to-machine communication where a human will rarely inspect the raw data directly.
Additional frequently asked questions
Does minification change the data in my JSON?
No. Minification only removes whitespace between tokens. All string values, numbers, booleans, and null values are preserved exactly. The minified JSON and the original parse to identical data structures in every compliant JSON parser.
How much smaller will my JSON be after minification?
It depends on indentation and nesting depth. A 2-space indented file with moderate nesting typically shrinks 25–35%. A 4-space indented file with deep nesting can shrink 40–50%. Files with very long string values (base64 data, descriptions) see smaller percentage reductions because string content is not touched.
Is minified JSON valid JSON?
Yes, fully valid. RFC 8259 allows any amount of whitespace between tokens, including zero whitespace. Minified JSON with no whitespace is just as valid as formatted JSON with 4-space indentation. Every compliant parser accepts both forms.
Can I minify JSON as part of a build pipeline?
Yes. The REST API at api.jsonfmt.dev/minify accepts a POST request with your JSON and returns the minified result. You can call this from a build script, CI job, or serverless function to automate minification as part of your deployment process.