How to reduce image file size to fit an upload limit
A form wants 200 KB and your photo is 4 MB. The four levers that change file size, in the order worth pulling them, and what to do when quality is not enough.
By Wajahat Rasoul ·
The four levers, in order
File size is a product of four things. Pull them in this order and you give up the least for the most:
- Pixel dimensions. The largest lever by far, and usually free — almost nobody needs a 4000px image for a web form. Use the image resizer.
- Format. The same photo as WebP is typically well under the JPG; the same screenshot as PNG is a fraction of the JPG and looks better. Which is which.
- Quality. Real but bounded — see where the visible damage begins.
- Colour count, for PNG only. Fewer distinct colours compress far better; invisible on flat graphics, destructive on photographs.
Why dimensions beat quality
Pixel count scales with the square of the dimensions. Halving both width and height leaves a quarter of the pixels, and roughly a quarter of the data before compression even begins.
| Longest edge | Pixels (3:2 photo) | Relative data |
|---|---|---|
| 4000 px | ≈ 10.7 M | 100% |
| 2000 px | ≈ 2.7 M | ≈ 25% |
| 1200 px | ≈ 0.96 M | ≈ 9% |
| 800 px | ≈ 0.43 M | ≈ 4% |
No quality setting gives you a 96% reduction without visibly destroying the image. Resizing does it while looking identical — provided the image is not displayed larger than its new size.
Hitting an exact KB or MB target
Guessing at a quality number, exporting, checking the size and repeating is the wrong way to hit a hard limit, and it is slow. A search is better: try a quality, measure the result, and narrow the range from there.
That is what the KB/MB reducer does. You give it a target — 100 KB, 2 MB, whatever the form demands — and it bisects the quality range to land just under it, then reports what it settled on. If quality alone cannot reach the target it downscales in steps and searches again, because a slightly smaller image at a decent quality beats a full-size one at a terrible quality every time.
When the target is very small
Targets under about 50 KB are a different problem. At that size quality alone will produce an unpleasant image, so lead with dimensions.
- Set a maximum width first — for a 20 KB passport-style photo, something in the region of 600px is usually the right ballpark.
- Crop out anything the requirement does not need. Fewer subjects means less detail to encode, and cropping is free. The cropper takes exact pixel values.
- Prefer a plain background if you have the choice. Busy backgrounds are expensive to encode and get mushy first.
- If the form accepts PNG and the image is a document scan or signature, PNG with a reduced colour count will beat a JPG at that size, and stay legible.
Common upload limits and what fits them
Limits vary by site and change without notice, so always read the form rather than trusting a table. As a starting point:
| Limit | Sensible longest edge | Format |
|---|---|---|
| 20–50 KB | 600–900 px | JPG at moderate quality |
| 100–200 KB | 1200–1600 px | JPG or WebP |
| 500 KB | 1600–2000 px | JPG or WebP |
| 1–2 MB | 2400–3000 px | JPG at high quality |
Things that do not help
- Renaming the extension. Calling a PNG
.jpgchanges nothing except whether software can open it. - Lowering DPI. DPI is metadata about intended print size; on its own it does not remove a single pixel. Why that is.
- Zipping a JPG. It is already compressed; a ZIP of one JPG is about the same size, sometimes slightly larger.
- Screenshotting the image. You get a re-compressed copy at screen resolution with fresh artefacts, and no control over any of it.
And one that helps more than expected
Stripping metadata. Camera files can carry embedded thumbnails and colour profiles worth tens of kilobytes. Any re-encode through a browser canvas — which is what these tools use — drops that automatically, which is also why metadata does not survive a web export.