How to compress an image to an exact file size

"Photo must be under 100 KB." If a form has ever rejected your image for being a few kilobytes too big, here is how file size actually works and how to hit a target reliably.

What controls an image's file size

Two things decide how many kilobytes a photo takes up: its pixel dimensions and its encoder quality. Dimensions are simple — a 4000 by 3000 image has twelve million pixels to store, while a 1000 by 750 version has under a million, so shrinking the dimensions cuts the size dramatically. Quality is the second lever. Formats like JPEG and WebP are lossy: they discard detail the eye barely notices, and a quality setting tells the encoder how aggressively to do that. Lower quality means a smaller file and, eventually, visible softening.

Crucially, file size is not something you set directly. You set quality and dimensions, and the size falls out of them. That is why hitting an exact number by hand is fiddly: you export, check the size, nudge the quality, and export again.

Why "exact" really means "under"

Almost every limit you meet is an upper bound — "under 100 KB", not "exactly 100 KB". That is good news, because no tool can produce a file of a precise byte count without padding it with junk. The realistic goal is to get comfortably under the limit while keeping as much quality as possible. A good compressor does this with a binary search: it tries a quality in the middle of the range, sees whether the result fits, and narrows in from there. In a handful of attempts it finds the highest quality that still slips under your target.

A reliable method

Work in this order for the sharpest result at any target:

  1. Right-size the dimensions first. Decide how big the image really needs to be. A web photo rarely needs more than about 1600 pixels on its long edge; a signature needs only a few hundred. If your source is a full-resolution camera shot, use a resizer to bring it down before you compress. Fewer pixels means the encoder spends its budget on the ones that remain, so the picture stays crisp.
  2. Choose a lossy format. JPEG for broad compatibility, WebP for the smallest files at the same quality. PNG is lossless and almost never fits a tight KB limit for a photograph, so convert photographic content away from PNG.
  3. Let a compressor search for the quality. Rather than guessing, set your KB target and let the tool find the best quality that fits. The image compressor on this site does exactly that, and it downscales automatically if even the lowest quality is still too big.

When you can't reach the target

Sometimes an image simply will not fit at the size you want it to look. A large, busy photograph forced under 50 KB has to lose either pixels or detail — there is no way around the physics. If the result is too soft, you have two honest choices: accept a smaller image by resizing further, or, if the form allows it, use a slightly higher limit. A good tool will tell you when it could not reach the target and give you the smallest version it produced rather than mangling the picture.

Common targets and quick presets

The most requested limits have dedicated presets so you can skip the setup entirely: 50 KB for signatures and the strictest forms, 100 KB for the most common photo and document caps, and 200 KB when you have room for a clearer image. For anything else, the full compressor takes any number you type. Whatever you choose, the work happens in your browser, so your file is never uploaded.

Related reading: PNG vs JPG vs WebP and reducing a photo's size for online forms.