CompressToSize

Compress image to exact size

Give it a number. It gives you the best-looking image that fits underneath. No account, no upload, no watermark.

Private by design. Your images are compressed inside this browser tab. Nothing is uploaded to any server.
Drop images here or click to choose · you can also paste with Ctrl+V JPG, PNG and WebP · as many as you like

Ad

Working backwards from the number

Every other compressor asks how much quality you want and tells you the file size afterwards. That is backwards for the situation almost everyone is actually in: a form has given you a hard ceiling, and quality is whatever is left over once the ceiling is met. This tool inverts it. You set the limit; a binary search over the encoder settings finds the highest quality that still fits, and stops there.

The difference shows up most on aggressive targets. Guessing your way down to 100KB by hand usually overshoots — you end up at 60KB because that was the slider position that finally worked, and you threw away forty percent of your quality budget for nothing. A search lands at 97KB, and the extra detail is visible.

What it handles

JPG, PNG and WebP, in any combination, as many at a time as you like. Each file is searched independently, so a small screenshot and a twelve megapixel photograph dropped in together both land under the same ceiling with their own optimal settings rather than sharing one.

Animated GIF is deliberately not supported. A browser canvas only sees the first frame, so any tool that claims to compress a GIF this way is quietly destroying the animation. Rather than ship that, the format is left out. HEIC is likewise excluded outside Safari, because other browsers cannot decode it at all and a silent failure is worse than a clear absence.

Popular targets

Nothing is uploaded, ever

Nothing you drop onto this page leaves your device. The image is decoded, re-encoded and handed back entirely inside the browser tab. There is no upload, no queue, and no temporary copy sitting on someone else's disk waiting for a retention policy to delete it.

That matters more than it sounds. The files people most often need to shrink are the ones they should be most careful with: passport scans, signatures, identity documents, medical forms. Handing those to an unknown server in exchange for a smaller file is a poor trade. Because the work is local, you can compress image to exact size with the network disconnected and get the same result.

It also means there is no queue to wait in and no daily allowance to run out of. Server-side compressors have to ration free use because every file costs them CPU time; here the CPU is yours, so you can compress image to exact size as many times as you like, on as many files as you like, without an account.

How the search works

Most compressors give you a quality slider and let you find out afterwards how big the file turned out. That is the wrong way round when you have a hard ceiling. This tool works backwards from the number: you ask it to compress image to exact size, and it searches for the encoder setting that lands just underneath.

The search is a binary search over the JPEG or WebP quality parameter. It encodes at the midpoint of the remaining range, checks the byte count against your target, and moves the range accordingly. Nine passes narrow the setting far finer than the eye can resolve, and every pass keeps the best result that fit — so what comes back is the highest quality version that still fits, not the first one that happened to work. Nine passes is also fast enough that you can compress image to exact size, look at the result, change the number and run it again without ever waiting on a progress bar.

When quality alone cannot get there, the tool reduces pixel dimensions in steps and searches again. That order matters: dropping quality first preserves your framing, while shrinking first throws away detail no quality setting can recover. Final dimensions are listed next to the file whenever a resize was needed, so an attempt to compress image to exact size never quietly returns something smaller than you asked for without saying what it gave up to get there.

Frequently asked questions

Is it really free?
Yes, with no account, no watermark and no file count limit. The page is funded by advertising, which is why there is no paywall.
Do you keep my images?
There is nothing to keep. Compression happens in your browser and no file is ever transmitted. Disconnect your network and the tool still works.
What is the smallest I can go?
Whatever the image will bear. At extreme targets the tool reduces the pixel dimensions as well as the quality, and it tells you the final dimensions rather than silently returning something that overshot.
Why does my PNG barely shrink?
PNG is lossless — the quality parameter does nothing to it. Only the pixel dimensions can change. Switch the output format to JPG or WebP if the destination allows it.
Does it work on a phone?
Yes. The same code runs on mobile browsers, including selecting images straight from the camera roll. Large images take a little longer because the encoding happens on your device.
Ad

Start from a use case