How to compress an image to an exact size in KB
Anyone who has filled in an online form for a passport, a university application or a public job listing has hit the same wall: “the photo must not exceed 100 KB”. Your phone just produced a 4 MB file, the form rejects it, and the obvious next step — dragging a quality slider until it stops complaining — is slow and gives worse results than it should.
This guide explains what actually determines a file’s size in kilobytes, how to reach a specific target reliably, and what quality you can realistically expect at each limit.
Why these limits exist
Portals that accept thousands of uploads a day cap file sizes to keep storage and bandwidth predictable, and to keep their own processing fast. The most common ceilings are 20 KB (signature images), 50 KB and 100 KB (ID and passport photos), 200 KB (document scans) and 1 MB (general attachments).
The limits are almost always checked on the raw file size, not on resolution. That matters, because it means you have two independent levers to get under the limit.
The two levers: quality and dimensions
A JPG’s size comes from two things multiplied together:
- How many pixels there are (width × height).
- How many bytes are spent per pixel, which is what the JPEG quality setting controls.
Most people only touch the second one. That is a mistake when the target is aggressive. Dropping quality far enough to squeeze a 4000-pixel-wide photo into 50 KB produces the blocky, smeared look everyone recognises as “over-compressed”. Reducing the dimensions first, then compressing at a sane quality, gives a dramatically better result at the same file size.
A rough rule: quality below about 60% starts to be visible; below 40% it is obvious. If you cannot hit your target at quality 60, you should be resizing, not compressing harder.
What actually fits in each size
These are realistic figures for a typical photograph (a portrait or an ID photo, moderate detail) saved as JPG at a quality where compression artefacts are not distracting:
| Target | Sensible resolution | Typical use |
|---|---|---|
| 20 KB | ~400 × 400 px | Signature images, tiny thumbnails |
| 50 KB | ~600 × 800 px | ID photos, passport-style portraits |
| 100 KB | ~1000 × 1300 px | Application photos, profile pictures |
| 200 KB | ~1600 × 1200 px | Document scans, web content images |
| 1 MB | ~4000 px wide | Full-resolution photos for general upload |
Two caveats. Images with lots of fine detail — foliage, textured fabric, crowds, text — compress worse and will need either more size or fewer pixels. Images with large flat areas — a plain background behind a face, a scanned document — compress much better, so you can often keep more resolution than the table suggests.
The reliable method
Rather than guessing at a quality slider, work backwards from the target:
- Start from the original, not from an already-compressed copy. Every JPEG save discards information permanently; compressing an image that has already been compressed twice stacks the damage.
- Set the target size directly. Our compressor lets you type a size in KB and searches for the highest quality that stays under it, resizing only when quality alone cannot get there. That search is the part that is tedious to do by hand.
- Check the result at 100%, not as a thumbnail. Artefacts hide at small sizes and appear the moment a reviewer zooms in.
- If it looks bad, reduce dimensions and retry. A 600 × 800 image at quality 75 will almost always look better than a 2000 × 2600 image forced into the same 50 KB.
There are dedicated pages for the most common targets if you want the limit pre-filled: 50 KB and 100 KB.
Format matters more than people expect
If the form accepts JPG, use JPG. It is the right tool for photographs and it is what these size targets were designed around.
Do not try to hit a small KB target with a PNG of a photograph. PNG is lossless: it cannot throw away detail to save space, so the only lever you have is resolution. A photo that fits comfortably in 50 KB as a JPG might need to be shrunk to postage-stamp size to fit as a PNG. Convert it to JPG first if the portal allows it.
PNG remains the correct choice for screenshots, logos and anything with sharp text or transparency — but those are rarely what these upload limits are about.
Common mistakes
- Compressing repeatedly. Each round of JPEG compression degrades the image further, even at high quality settings. Always go back to the original file.
- Screenshotting the photo to make it smaller. This re-encodes an already-compressed image and usually changes the aspect ratio, which many portals also validate.
- Ignoring dimension requirements. Plenty of forms specify both a maximum file size and a required pixel size (e.g. 413 × 531 for some ID photos). Resize to the required dimensions first, then compress to the target. Our resize tool handles the first half.
- Trusting the file manager’s rounding. Windows and macOS sometimes display “100 KB” for a file that is actually 102,400 bytes or more. If a form rejects a file that looks like it fits, aim slightly under the limit.
A note on privacy
ID photos, signatures and scanned documents are among the most sensitive files most people ever upload. It is worth knowing what happens to them: most online compressors upload your file to a server, process it there and send it back.
Imgnest does not. Every tool here runs in your browser, so the image never leaves your device — you can load a tool page, disconnect from the internet, and it still works. For a passport scan, that difference is worth caring about. We wrote more about why in-browser processing is more private.
Summary
Hitting an exact KB target is not about finding a magic quality number. It is about accepting that file size is resolution and quality together, reducing dimensions to something sensible for the target, and letting the compressor find the best quality that fits. Do that and a 100 KB photo can look perfectly sharp — because at 1000 pixels wide, 100 KB is plenty.