Strip every space and line break from JSON without touching the data. Useful for environment variables, query strings and payload size tests.
Input · drop a file
Output
How a minifier shrinks code, pass by pass
Minifiers don’t zip your file — they rewrite it into the smallest code that behaves identically. Step through what a JavaScript minifier like Terser does to one small function. CSS and HTML minifiers follow the same idea with their own rules.
/* Total price of a ticket */
function ticketTotal(garments) {
let total = 0;
for (const garment of garments) {
total = total + garment.price;
}
return total;
}
Readable source with a comment, indentation and descriptive names.
172 bytes · 0% smaller than the original
What minifying JSON removes
Only insignificant whitespace — spaces, tabs and newlines between tokens. Whitespace inside strings is data and is kept. Keys are not renamed and values are not changed, so the minified document parses to exactly the same object.
When it helps
Putting JSON into a single-line environment variable or a .env file.
Embedding JSON in a URL or an HTML data- attribute (then URL-encode it).
Measuring the real wire size of a payload.
For HTTP responses, gzip or Brotli compression usually matters more than minifying: repeated whitespace compresses very well. Minify when the JSON is stored or copied as-is.
Questions
Is minified JSON still valid JSON?
Yes. Whitespace between tokens is optional in the JSON grammar.
Can I turn it back into readable JSON?
Yes — paste it into the JSON formatter. Minifying loses nothing except the original indentation style.