toolqik

119 · JSON

JSON Minifier

Remove whitespace from JSON without changing a single value. Shows the size saved.

Runs in your browser
Output
Minified JSON

  

About this tool

Minifying JSON removes the spaces, tabs and line breaks that make it readable but that machines don’t need. The data is identical; it’s just smaller. Smaller JSON means faster API responses, smaller config payloads and less storage. Paste JSON above and the minified version appears instantly, with the size before and after.

Lossless: your values stay exactly as written

Most online minifiers parse the JSON and print it again. That quietly changes data: 12345678901234567890 becomes 12345678901234567000 (JavaScript numbers are exact only up to 253), 1.50 becomes 1.5, and "\u00e9" becomes "é". This minifier validates the JSON first and then only removes whitespace between tokens, so every number, string and escape sequence is kept byte for byte.

Output options

  • JSON Lines: for a top-level array, writes each item on its own line. This is the format many log tools, BigQuery, and bulk APIs (such as Elasticsearch and OpenAI batch files) expect.
  • As an escaped JSON string: wraps the minified JSON in quotes and escapes it, ready to embed as a string value inside another JSON document or an environment variable.

How much does minifying save?

For pretty-printed JSON with 2-space indentation, minifying typically removes 15–40% of the size; deeply nested data saves more. If your server already uses gzip or Brotli compression, the transfer saving is smaller, because whitespace compresses very well. Minifying still helps for storage, for logs, and wherever JSON is embedded uncompressed.

Minify JSON in code

const minified = JSON.stringify(JSON.parse(text));
// Note: JSON.parse rounds integers above 2^53 and rewrites 1.50 as 1.5.

Need the reverse? The JSON formatter pretty-prints minified JSON.

FAQ

What does a JSON minifier do?

It removes all whitespace that is not inside a string: spaces, tabs and line breaks between keys, values and brackets. The data does not change, only its size.

Does minifying JSON change the data?

Not with this tool. It only removes whitespace between tokens, so numbers, strings and escape sequences stay exactly as written. Tools that parse and re-print can round large numbers and rewrite values.

How do I convert a JSON array to JSON Lines?

Turn on “JSON Lines” and paste an array. Each item is written on its own line with no surrounding brackets or commas.

Is minified JSON still valid JSON?

Yes. Whitespace between tokens is optional in JSON, so a minified document is equally valid and parses to the same data.

Should I minify JSON for an API?

It saves bandwidth, but if responses are already gzip- or Brotli-compressed the gain is small. Many APIs pretty-print in development and minify in production.

esc
↑↓ navigate↵ open