بِت

Compress an image to a target size without guessing the quality

· 4 min read

A form says the file must be 200 KB or less, and you have no idea which quality setting produces that number. So you try: quality 80 gives 410 KB, 60 gives 260, 40 gives 170, and now it is under the limit with the image damaged for no reason. Being able to compress an image to a target size ends the guessing: the tool searches for the highest quality whose output still fits under the limit.

An image measured after compression to a target size, with quality compared at three sizes
The limit is not a target to hit, but a ceiling to find the best quality beneath.

Why one quality setting cannot serve every size

Because the relationship between quality and bytes is not a straight line, and it differs from image to image. A busy photo drops from 500 KB to 150 between quality 90 and 60, while a shot on a flat background reaches the same number at 80. No table can tell you the right quality: the number depends on the content, the dimensions and the format.

Compress your image now — no upload, no accountOpen the tool

How to compress an image to a target size with a binary search

The encoder tries the middle quality, 50, and measures the result. If it is over the ceiling it moves to the lower half, 25; if under, to the upper half, 75; then repeats. Because the range runs from 1 to 100, seven attempts are enough to land on the highest quality that stays under the limit, and a final pass can refine with fractional quality.

When shrinking dimensions beats lowering quality

When the ceiling is very low. Quality 30 on a 2000-pixel photo gives a small file with visible noise across sky and skin, and that damage does not come back after saving. Better to come down to 1200 or 1000 pixels and keep quality at 75: the file is smaller, the detail is cleaner, the damage far less visible. Everything the eye needs comes from the dimensions, and whatever quality erases never returns.

The quick rule: under 100 KB, cut the dimensions to 1000 pixels first and then compress; at 300 KB or more, quality alone will do. A ceiling that forces obvious damage is not a ceiling worth the picture.