A counted example
230 bytes in, 172 bytes out
Press Load a spaced-out order. The freight note above is 230 UTF-8 bytes with a 2-space indent. After the gaps between tokens disappear, 172 bytes remain. Fifty-eight bytes. About a quarter of the file.
That quarter is indentation.
| UTF-8 bytes | What you are looking at | |
|---|---|---|
| Spaced-out order | 230 | Newlines and two spaces per level |
| Minified | 172 | One line, no space after : or , |
| Removed | 58 | Whitespace between tokens only |
The order id, the lane, the mailbox and the dock note are the same length on both sides. A minifier does not shorten keys, and it does not abbreviate Rotterdam to Felixstowe.
Press the compact button next. The meter should read 172 on both sides and 0% removed. If the file was already one line, you are finished.
Gzip already ate this saving
HTTP responses that send Content-Encoding: gzip or br compress runs of spaces down to almost nothing. A pretty 40 KB body and its minified twin often differ by a few hundred bytes on the wire, sometimes less. Minifying and then gzipping is not two savings stacked on top of each other.
Leave an API body readable when the server already compresses it. You will spend longer decoding a one-line payload in a ticket than those 58 bytes will ever repay.
Minify when the limit counts the raw text, before any compressor runs.
A space inside quotes is the customer's text
RFC 8259 treats space, tab, line feed and carriage return as skippable only between tokens. The same four characters inside a string are data.
leave with dock office keeps both spaces. A note saved with a trailing space keeps the trailing space. The two-character escape \n stays backslash plus n, because that is how the file spelled a newline, not a line break sitting between tokens.
This page copies each string through unchanged. It does not trim values, and it does not rewrite escapes into a shorter form.
What the scan deletes, and what it copies
| In the source | In the output |
|---|---|
Indent, newlines, spaces around : and , | Removed |
Spaces inside "..." | Kept, including leading and trailing ones |
1.0, 1e2, a 19-digit id | Copied digit for digit |
| A key written twice | Both copies stay. Nothing is collapsed |
| A leading byte-order mark | Dropped. It is not JSON |
A different operation
Parse, then print, and the id changes
A lot of minifiers call JSON.parse and then JSON.stringify. Whitespace disappears. So does the original spelling of every number.
{"id":1234567890123456789} comes back as {"id":1234567890123456800}. JavaScript stores numbers as doubles, and a double holds about 15 digits. Chat and ticket systems hand out 19-digit ids all day. The whitespace is gone and the identifier is wrong.
The same round trip turns 1.0 into 1, turns 1e2 into 100, and keeps only the last copy of a duplicated key. All three results are legal JSON. All three are silent edits. A minifier should not be an editor.
Broken text stops here. The line under the output names the line and the column, and nothing is written. Trailing commas, comments, single quotes and a leading zero on a number are rejected on purpose. Guessing at a repair belongs on the JSON Fixer, where a guess is the whole point.
Ceilings that count the raw bytes
These are the spots where the meter on this page is the number that matters. Compression is not in the path yet, or the limit is defined on the uncompressed text.
| Where the text sits | The ceiling people hit |
|---|---|
| A cookie | Browsers commonly cap one cookie around 4,096 bytes |
localStorage | About 5 MB per origin, shared with every other key that origin stores |
| A CloudWatch log event | 256 KB for the event |
| A DynamoDB item | 400 KB for the whole item |
| A query string | No single rule. Servers often fail somewhere around 8 KB of headers |
Fifty-eight bytes will not rescue a 400 KB item. Shorter key names will. That is an API change, not a minify step, and it breaks every client still sending the old names.
UTF-8 is the unit on the meter. Malmö is five characters and six bytes, because ö takes two. JavaScript's string.length counts UTF-16 code units, which is a third number again once an emoji shows up. Wire limits and storage limits speak bytes.
Do not drop the result between script tags
A string value that contains the characters </script> ends an HTML script element in the middle of the JSON. U+2028 and U+2029 are legal inside a JSON string and act as line breaks in JavaScript, so either one snaps a script that embeds the payload raw.
This page does not rewrite those characters. The output is for a JSON parser. If the next stop is a <script> block, escape <, U+2028 and U+2029 yourself. React does that escaping for a reason.
Reading it, escaping it, or forcing one line
The meter at 0% with a valid status means stop. There is no further minify step. Gzip, Brotli, or a shorter schema are the remaining options, and only the schema changes the parsed data.
Need to read the payload instead of shrinking it? Open the JSON Beautifier. A one-line body is a poor thing to debug. Need the text escaped for a source file? That is JSON Stringify, a different job, because the quotes and backslashes multiply. JSON to One Line is the other page people open when the search was "make this one line." Use this page when you want the byte change and number text left alone.
Nothing in the minify path leaves the browser. Tokens, auth headers and customer notes stay in the tab. Copy and download run locally after the page has loaded.
