Skip to content

How to compress an image to a specific file size

How target-size compression works, measured results for 20 KB to 500 KB targets, and what to do when a target cannot be reached.

By Convero · Published

Open the compressor with a target size, such as 100 KB, and it lowers the JPG or WebP quality step by step until the file fits. If the image is very large, even the lowest quality may not fit; then reduce its dimensions too. PNG cannot be compressed to a target size because it is lossless.

How the target is reached

Convero first saves the image at quality 90. If that is over the target, it runs an eight-step binary search on the quality setting and keeps the highest quality that fits. The image is never enlarged, and the page shows the real final size.

Presets open the compressor ready to use: 20 KB, 50 KB, 100 KB, 200 KB, 500 KB and 1 MB.

Measured results

Target-size search on the photo stand-in, saved as JPG, Chromium on a 10-core Mac
Image sizeTargetResultReachedQuality usedTime
1920 × 108020 KB19.7 KBYes1568 ms
1920 × 108050 KB47.7 KBYes2553 ms
1920 × 1080100 KB98.6 KBYes3958 ms
1920 × 1080200 KB199.6 KBYes6568 ms
1920 × 1080500 KB479.7 KBYes8584 ms
4000 × 300020 KB72.9 KBNo2401 ms
4000 × 300050 KB72.9 KBNo2302 ms
4000 × 3000100 KB94.7 KBYes14273 ms
4000 × 3000200 KB196.0 KBYes22279 ms
4000 × 3000500 KB497.3 KBYes37335 ms

When a target cannot be reached

A 12-megapixel image (4000 × 3000) could not get below 72.9 KB even at the lowest quality, so the 20 KB and 50 KB targets failed. Convero reports the smallest size it reached instead of pretending. The fix is to make the image smaller first with Resize image, then compress it again. Small targets on large images also cost visible quality: at 20 KB the 1080p result had a PSNR (a measure of closeness to the original) of 29 dB and showed clear blockiness.

How this was measured

Measured on 6 December 2026 in a Chromium 156 browser on a 10-core Mac, using the browser's own canvas encoder, which is what Convero's image tools use. The three test images are generated from a fixed seed by scripts/benchmarks/image-benchmark.js in Convero's public repository, so anyone can run the same test. They are synthetic: the photo stand-in has strong fine grain, which makes lossless formats look worse than they would on a clean photo. Other browsers ship different encoders and will give different numbers.

Tools for this