Skip to content

JSON Minifier

Minify JSON to one line and check its UTF-8 size before and after. The minifier preserves the original digits of large integers.

Runs in your browser Free, no sign-up
Loading tool workspace...

What is JSON Minifier?

This JSON minifier compresses JSON by removing all the whitespace that only exists for human readers: indentation, line breaks and spaces after colons and commas. The data stays exactly the same, but the text gets smaller, often 20–40% for typical indented JSON, and fits on a single line; the status bar shows the size before and after, in bytes.

Minified JSON is what you want in API responses, network payloads, cache entries, environment variables and anywhere JSON must be a one-line string. Values are copied exactly as written, so large IDs and decimals such as 1.50 aren't altered the way a JSON.parse round trip alters them. Invalid JSON is reported with its line and column instead, with a one-click fix for common mistakes.

How to use JSON Minifier

  1. Paste formatted JSON into the input panel, open a file, drop one on the page, or load it from a URL.
  2. The minified, single-line JSON appears in the output panel instantly.
  3. Check the status bar to see the size before and after, and how much you saved.
  4. Copy the result or download it; a file you opened downloads as name.min.json.
  5. Click Beautify to turn it back into readable, indented JSON.

Key features

  • Removes all insignificant whitespace and line breaks
  • Produces valid single-line JSON
  • Shows the size before and after, and the bytes saved
  • Keeps numbers, strings and escapes exactly as written
  • Errors with line and column, and one-click fixes for common mistakes
  • Open files up to 50 MB, drag and drop them, or load JSON from a URL
  • Optional key sorting for stable, diff-friendly output
  • Copy, or download as a .min.json file
  • Runs entirely in your browser

Common use cases

  • Shrinking JSON payloads for APIs and webhooks
  • Storing JSON in environment variables or one-line config values
  • Embedding JSON in HTML data attributes or script tags
  • Reducing the size of JSON stored in databases, caches and local storage
  • Preparing JSON for JSON Lines (one object per line) files

Technical details & standards

The JSON is checked with a strict RFC 8259 parser and re-printed without any of the insignificant whitespace RFC 8259 allows, while whitespace inside string values is kept. Unlike JSON.stringify(JSON.parse(text)), every value is copied exactly as written: integers above 9007199254740991 keep their digits, numbers such as 1.50 and 1e5 aren't rewritten, and escape sequences such as \u00e9 stay as they are. Sizes are measured in UTF-8 bytes, which is what the file or HTTP response weighs.

Minifying is safe for data but not a substitute for compression: HTTP gzip or Brotli usually shrinks JSON far more, and works on top of minification. Files and URL responses up to 50 MB can be opened, and everything runs in your browser.

Frequently asked questions

Does minifying JSON change the data?

No. Only whitespace outside of strings is removed; keys, values, string contents and order stay the same, and numbers keep their exact digits, so any parser reads the minified JSON identically.

How much smaller does minified JSON get?

Typically 20–40% for JSON indented with 2 or 4 spaces, depending on how deeply nested it is; the status bar shows the exact saving for yours. Gzip compression on top of minification usually reduces the size much further.

How do I minify JSON in code?

JavaScript: JSON.stringify(JSON.parse(text)). Python: json.dumps(data, separators=(",", ":")). Command line: jq -c . file.json.

Can I turn minified JSON back into readable JSON?

Yes. Click Beautify above the panes, or paste it into the JSON Formatter. Minifying and formatting are fully reversible.

Can I use this as a JSON size calculator?

Yes. The status line under the editor shows the size before and after minifying, such as 1.2 KB → 840 B, and how much was saved as a percentage. Sizes are counted in UTF-8 bytes, the same as a file on disk or an HTTP response without compression.

Is my data safe?

When you request a URL, your browser sends the request directly to that destination. CodeUnpack does not proxy the request.

Does it work offline?

Once the page has loaded, you can work with local input offline. Loading a URL requires a connection.

More formatters & viewers tools

View all