Compress Image to a Target Size
Skip the quality slider guesswork. Tell it the size you need, say 100 KB, and it finds the highest quality that fits, keeping your image's original width and height by default.
Click to choose images, drag and drop them here, or paste with Ctrl+V
JPG, PNG, WebP. Select more than one to compress in bulk. Stays on your device, nothing is uploaded.
Your compressed image will appear here once generated.
For JPEG/WebP, it binary-searches quality at your image's original size. If "Allow resizing" is off and quality alone can't hit the target, you'll get the smallest size possible without changing dimensions. PNG is lossless, so hitting a small target needs resizing turned on. JPEG or WebP will get you much closer to a small target at full size.
How it works
The quality search for JPEG and WebP runs eight rounds of binary search over the encoder's quality parameter: encode at 0.5, compare the byte count against your target, then halve the interval up or down and encode again. Eight rounds pin the quality value down to within about 0.4% of its full range, which is why results usually land just under your target rather than far below it. With resizing enabled, that same search repeats at progressively smaller dimensions, shrinking 15% per step, until it finds a scale where quality alone can close the remaining gap.
PNG needs a completely different lever, because the browser's canvas encoder only
writes full truecolor files and has no quality knob at all. So this page ships its own
indexed-color PNG encoder: a median-cut quantizer builds a palette of 128 down to 8
representative colors, Floyd-Steinberg dithering diffuses the rounding error so
gradients don't turn into visible bands, and the palette indices are compressed with
the browser's native CompressionStream and written byte by byte into a
valid color-type-3 PNG, one byte per pixel instead of three or four. That's the same
technique pngquant and TinyPNG use, and on screenshots and flat graphics it routinely
cuts 60-80% without resizing. It requires a fully opaque image, since indexed PNG can't
store per-pixel transparency.
A practical shortcut before you reach for resizing: at equal visual quality, WebP files come out roughly a quarter to a third smaller than JPEG, so an image JPEG can't squeeze under your target at full resolution often fits once you switch the output format to WebP.
All of this runs against an in-memory canvas in this tab. You can verify it: open DevTools, switch to the Network tab, and compress something. No request ever carries your image, in either direction, and the tool keeps working with Wi-Fi switched off.
Common questions
Why can't it always hit my exact target size?
For JPEG and WebP the tool binary-searches the quality setting at your image's original dimensions. If even the lowest quality is still bigger than your target, you get the smallest file possible without changing the width and height. Turn on "Allow resizing" to let it shrink dimensions too, which reaches much smaller targets.
Which image formats are supported?
You can drop in JPG, PNG, or WebP files and export as JPEG, WebP, or PNG. JPEG and WebP give the best size control because their quality setting is adjustable. PNG is lossless, so its size varies and small targets usually need resizing turned on.
Is my image uploaded anywhere?
No. Compression happens entirely in your browser using the canvas API, so your images never leave your device. That also means there's no server-side file size cap or upload queue.
Can I compress several images at once?
Yes. Select or drag in multiple files, set one target size, and hit "Compress all". You can download the results one by one or grab everything as a single .zip.
From the blog: How to Compress Images Without Losing Quality