Guides

How to resize an image to an exact KB size

The method portals require — hitting a file-size band exactly, at fixed pixel dimensions, without wrecking the picture.

3 min read · updated 2026-08-30

"Resize to 50 KB" sounds like it should be a slider. It is not, because file size is an output of JPEG compression rather than an input to it. You cannot ask an encoder for 47 KB. You can only pick a quality level and see what comes out.

Here is how the target is actually hit, and why it sometimes cannot be.

The two constraints

An exam upload usually fixes both:

The dimensions are not negotiable, so the only lever is compression quality. And quality maps to file size unpredictably: it depends entirely on how much detail the picture contains. A busy photograph at quality 60 might be 80 KB; a plain one at the same setting might be 20 KB.

Searching for the quality

The standard approach is a binary search.

Encode at high quality and check the size. Too big? Encode halfway between that and the minimum. Still too big? Halve again. Under the limit? Go back up. After about ten rounds you have found the highest quality that still fits under the ceiling, to within a fraction of a per cent.

That is what our resizer does — roughly eleven encodes per export, all in your browser, in well under a second. Ten rounds is the point of diminishing returns: further rounds change the file by bytes, not kilobytes.

The important part is highest quality that fits, not simply something that fits. Compressing to 12 KB when the ceiling is 50 KB throws away detail for no reason.

When the band cannot be met

Two ways this happens.

The floor is above what the image can produce. Fixed dimensions, quality already at maximum, and the file is still under the minimum. There is no more detail to encode. The fix is to pad the file with data decoders ignore — covered in why portals reject files that are too small.

The ceiling is below what the image can produce. Rare, but it happens with large dimensions and tight limits — an 800 x 400 declaration under 50 KB, say. Even minimum quality overshoots.

Here the only remaining lever is detail itself. Our tool applies a slight blur and retries, up to three passes, because a smoother image compresses further. It tells you when it has done this.

If even that fails, it says so plainly rather than handing you a file that will be rejected. That is worth more than a false success — check whether the limit you entered is right, because a genuinely impossible band usually means a transcription error.

Why not just use a slider

Because the number you care about is the output. A quality slider makes you guess, export, check the size, adjust and repeat. Specifying the band directly and letting the tool search is the same work done properly.

Doing it

Open the custom size resizer, or your exam's page for the sizes pre-filled. Under Required size, set width, height, minimum KB and maximum KB. Everything after that is automatic, and the result panel shows what happened: final size, whether it sits inside the band, the DPI written into the file, and whether anything was padded or softened.

Setting the minimum to 0 and the maximum to something large gives you the best quality at those dimensions, if you only need a resize rather than a specific size.

Resizers mentioned here

More guides

All 11 guides →