JSON Minifier

Remove the spaces and line breaks a parser ignores, then read the UTF-8 byte count on both sides. String text and number spellings stay as you pasted them.

Source0UTF-8 bytes
Minified0UTF-8 bytes
Removed00%

Paste pretty-printed JSON. The drop, if there is one, is whitespace between tokens.

Source

Minified

Waiting

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 bytesWhat you are looking at
Spaced-out order230Newlines and two spaces per level
Minified172One line, no space after : or ,
Removed58Whitespace 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 sourceIn the output
Indent, newlines, spaces around : and ,Removed
Spaces inside "..."Kept, including leading and trailing ones
1.0, 1e2, a 19-digit idCopied digit for digit
A key written twiceBoth copies stay. Nothing is collapsed
A leading byte-order markDropped. 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 sitsThe ceiling people hit
A cookieBrowsers commonly cap one cookie around 4,096 bytes
localStorageAbout 5 MB per origin, shared with every other key that origin stores
A CloudWatch log event256 KB for the event
A DynamoDB item400 KB for the whole item
A query stringNo 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.

Questions that show up once the byte count looks wrong

Whitespace, gzip, long ids, and what this page refuses to rewrite.

Is minifying the same as gzip?

No. Minifying deletes spaces, tabs and line breaks between tokens. Gzip and Brotli compress the remaining bytes, including the keys and the values. An API that already sends Content-Encoding: gzip gains little from a minify step.

Why did a long id change in another minifier?

That tool parsed the JSON into JavaScript numbers and printed them again. A double holds about 15 digits, so 1234567890123456789 becomes 1234567890123456800. This page copies the digits as written. Store ids like that as strings if other tools will parse them.

Will spaces inside a string disappear?

No. Spaces, tabs and newlines inside quotes are part of the value. Only the gaps between tokens are removed. A trailing space in a note stays a trailing space.

The removed percent is 0. Did something fail?

No. The source had no whitespace between tokens. Load the spaced-out order, then the compact order, and watch the same document go from 58 bytes saved to zero.

Why reject comments and trailing commas?

A file with either one is not JSON. Handing back a "fixed" document would hide a file that the next parser rejects. The message names the line and column. The JSON Fixer page is the one that attempts a repair.

Does the JSON get uploaded?

No. The scan, the byte count, copy and download all run in the browser tab.