Minify JSON without removing meaningful spaces
Minification removes spaces and line breaks that separate JSON tokens while leaving whitespace inside quoted strings alone. It makes a valid document shorter without changing its data.
When should you use it?
- Reduce a JSON fixture or embedded payload.
- Compare readable and compact byte sizes before transfer.
- Copy a one-line value into a system that expects compact JSON.
Example: compact an order without changing its identifier or address
The indentation and line breaks disappear. The space in New York stays, array order stays, and the large id keeps every digit. The size panel measures the UTF-8 bytes of these two representations.
{
"id": 9007199254740993,
"city": "New York",
"items": [
{ "sku": "A-12", "quantity": 2 }
]
}{"id":9007199254740993,"city":"New York","items":[{"sku":"A-12","quantity":2}]}What changes when JSON becomes one line?
JSON permits spaces, tabs, carriage returns, and line feeds between tokens. A minifier removes that optional layout. Characters inside a quoted string remain data: the space in "New York" and the escape in "line\nnext" must survive. Removing whitespace with a regular expression can corrupt those values, so this tool first parses strict JSON and writes its original tokens without structural whitespace.
The operation preserves member order, duplicate names, number notation, and string escapes. It does not shorten property names, delete empty values, or repair invalid JSON. A document that is already compact may show no reduction.
How much smaller will a minified JSON file be?
The saving depends on the input. An indented array with thousands of short records has more removable layout than a document dominated by long strings. Compare UTF-8 byte counts for your actual document instead of relying on a fixed percentage. Non-ASCII text can occupy several bytes per character, so character count alone does not measure the file size.
Minification and HTTP compression are separate operations. This page returns readable JSON text with compact layout; gzip and Brotli create compressed byte streams at the transport or file layer. Measure the compressed response in your own server setup if transfer size is the goal. Keep an indented source copy when people will maintain the file in version control.
Fewer bytes. The same values.
Minification removes spaces and line breaks between JSON tokens. It keeps meaningful spaces within strings and preserves the exact spelling of every number.
Start with valid JSON
Invalid input is reported, never silently repaired.
Remove structural whitespace
Minify without changing strings, keys, or array order.
Compare and download
See the UTF-8 byte sizes and the percentage removed.
How do I remove JSON whitespace without changing spaces inside strings?
Run Minifier on a valid document. It removes spaces, tabs, and line breaks between JSON tokens while leaving quoted string content alone. Compare UTF-8 byte counts afterward to see the actual saving for this input; the percentage depends on how much optional whitespace it contained.
JSON: a space inside a value is data
json{
"city": "New York",
"count": 3
}The compact result is {"city":"New York","count":3}. The space in “New York” remains because it is inside a string value.
Is minified JSON the same as compressed JSON?
No. Minification removes optional characters in the document. A transport compressor such as gzip works on the resulting bytes and may achieve a different saving. The tool reports the uncompressed UTF-8 size of its own input and output.
What should you check before using the result?
A smaller text document is not the same as compressed transport. HTTP gzip or Brotli can produce a different saving. Minification cannot fix invalid JSON.
Minification is not compression
Minification changes the JSON text by removing optional whitespace. Transport compression such as gzip or Brotli is separate and can reduce transferred bytes further. The size comparison here measures uncompressed UTF-8 text.
When nothing gets smaller
An already compact document may show no savings. Whitespace within string values must remain: removing it would change the data. You can return to the formatter whenever you need a readable copy.
Technical reference: JSON syntax and interoperability · RFC 8259