JSON Minifier
Collapse formatted JSON into a single compact line and see the byte-for-byte saving before and after.
Your data stays on your device
Input — JSON
- characters
- 0
- lines
- 0
- size
- 0 B
Output — Minified JSON
- characters
- 0
- lines
- 0
- size
- 0 B
Options
Makes two documents comparable with a plain text diff.
Keeps integers beyond 2^53-1 exactly as written instead of rounding them. Key sorting is skipped in this mode.
About this tool
Minification removes insignificant whitespace — the indentation and line breaks that exist purely for human readers. The parsed value is identical; only the transport size changes. It matters most for payloads embedded in URLs, environment variables, HTML attributes or high-volume API responses.
The tool reports input size, output size, bytes removed and the resulting ratio, measured in UTF-8 bytes rather than characters so multi-byte content such as Korean, Japanese or emoji is counted accurately.
How to use this tool
- Paste or upload the JSON document you want to compress.
- Press Minify. The document is parsed first, so invalid JSON is rejected with a location instead of being silently mangled.
- Read the statistics bar for input bytes, output bytes and the percentage saved.
- Copy the single-line result or download it as a .json file.
Key features
- Single-line output with all insignificant whitespace removed
- UTF-8 byte counts for input and output, not just character counts
- Compression ratio and absolute bytes saved
- Validation before minification so output is always parseable
- Optional key sorting while minifying, for reproducible payloads
- Copy and download the compact result
Example
Input — JSON
{
"user": {
"id": 7,
"tags": ["a", "b"]
}
}Output — JSON
{"user":{"id":7,"tags":["a","b"]}}Good to know
- Minification only removes whitespace. It cannot shorten key names or restructure data; that requires changing your schema.
- Savings on already-compact API responses are often under five percent. Gzip or Brotli at the transport layer usually saves far more.
- Whitespace inside string values is data, not formatting, and is preserved exactly.
Frequently asked questions
Does minifying change my data?
No. The document is parsed into a value and re-serialised without whitespace, so every key, value and array order is preserved. Only the text representation shrinks.
Should I minify if my server already uses gzip?
Usually not worth it on its own. Compression algorithms handle repeated whitespace extremely well, so the marginal gain is small. Minify when the JSON goes somewhere that is not compressed, such as a query string or a data attribute.
Why is the byte count larger than the character count?
Characters outside ASCII take two to four bytes each in UTF-8. A document full of Hangul or emoji has far more bytes than characters, and bytes are what actually travel over the network.
Can I get the formatted version back?
Yes — minification is lossless with respect to the data. Run the result through the JSON Formatter to restore indentation.
Your data stays on your device
Your data is processed locally in your browser and is not uploaded to our server. This page keeps working after you go offline, because there is nothing to send.