What is JSON minification?
Minifying JSON removes every character a parser does not need: indentation, line breaks and the spaces after colons and commas. The data is unchanged — a minified document parses to exactly the same value as the formatted one — but it is smaller, which matters for API responses, payloads embedded in HTML, localStorage quotas and files bundled into a JavaScript build.
Many online minifiers simply run JSON.parse followed by JSON.stringify. That quietly changes your data: integers above 2^53 are rounded, duplicate keys disappear and escapes such as \u00e9 are rewritten. This minifier validates the input first and then strips whitespace from the original text, so every number literal and string is preserved byte for byte.
Whitespace inside strings is never touched — only the formatting between tokens. If the input is not valid JSON you get the exact line, column and an excerpt of the problem instead of a broken result.
How to use the JSON Minifier
- Paste formatted JSON into the input box, or click Sample to load a
package.json-style example. - The minified result and the size savings appear instantly; any syntax error is shown with its location.
- Optionally tick Sort keys A–Z for a canonical key order, or Escape non-ASCII if the JSON will pass through a system that only handles ASCII.
- Click Copy or Download to save the result as
data.min.json.
Example
This 68-byte document, indented with two spaces: { "id": 7, "tags": [ "css", "wp" ], "draft": false } spread over eight lines, minifies to 42 bytes — 38% smaller:
{"id":7,"tags":["css","wp"],"draft":false}When minifying JSON is worth it
- Inline data in HTML — for example JSON-LD structured data or a hydration payload — where every byte is in the critical rendering path.
- Static JSON files served from a CDN or bundled into a JavaScript build, such as translation files or product catalogues.
- Storage with quotas: localStorage (around 5 MB per origin), cookies (about 4 KB) and URL parameters.
- Environment variables and CLI arguments that must fit on a single line.
Minification versus compression
If your server already uses gzip or Brotli, the network saving from minification is smaller than the raw numbers suggest, because repeated indentation compresses extremely well. Minification still reduces parsing work, memory and storage size, and it is the only option where no transport compression applies. For readable output, reverse the process with the JSON Formatter.
Frequently Asked Questions
Does minifying change my data?
No. Only whitespace between tokens is removed. Strings, numbers and key order stay exactly as written, unless you enable key sorting.
Why is my JSON larger after enabling "Escape non-ASCII"?
Each non-ASCII character becomes a six-character \uXXXX escape, and emoji become two of them. Use the option only when a downstream system cannot handle UTF-8.
Can I minify JSON that contains comments?
Comments are not valid JSON, so the minifier reports them as an error with their location. Remove them first; the JSON Validator explains each rule in detail.
How much smaller will my file get?
Typically 15–30% for 2-space indented JSON and more for 4-space or tab indentation and deeply nested data. The exact saving is shown above the output.
Is it safe to paste production data?
Yes. Minification runs entirely in your browser and nothing is sent to a server.