1. Home
  2. Blog
  3. How to compress an image to 20, 50 or 100 KB (and what you lose)
Guide

How to compress an image to 20, 50 or 100 KB (and what you lose)

Cover image for: How to compress an image to 20, 50 or 100 KB (and what you lose)

Job applications, exam registrations, visa portals and bank KYC forms all love a hard file-size limit: "photo must be between 20 and 50 KB", "document under 100 KB". Your phone photo is probably 2 to 5 MB, so it will not upload as it is. This guide shows how to get under the limit with the least damage, using numbers from our own tests.

The two things that make a file smaller

A JPG's size depends on two things: how many pixels it has, and how hard each pixel is compressed (the quality setting). To hit a size limit you can turn either dial, and the order matters.

Lower quality first. In our tests, going from quality 95 to 60 left a photo at about 28% of its size, and it still looked fine at normal viewing size. Below about 50 you start to see blocky patches and smeared edges.

Shrink the pixels second. If quality 50 is still too big, the only option is fewer pixels. Halving the width leaves a quarter of the pixels, which is a far bigger saving than any quality change (we measured this in resize vs compress).

Our "compress to N KB" tools do exactly this in that order: they test qualities from 95% down to 50%, keep the highest one that fits under your limit, and only scale the image down if even 50% is too large.

Results on a large camera-style photo

To see what happens to a big image, we made a 4000 x 2667 test photo, 2.15 MB as a JPEG. It is a real photograph enlarged with a little noise added to imitate a camera sensor, so treat the exact figures as typical rather than universal. We ran it through each page at its default setting.

TargetResultDimensionsQuality used
20 KB19.7 KB512 x 34251%
50 KB49.8 KB931 x 62152%
100 KB98.0 KB1454 x 96951%
200 KB198.3 KB2251 x 150156%
500 KB498.9 KB4000 x 266758%

Every result was under its limit. Note the pattern: at 20 KB the picture ends up at 512 pixels wide, at 50 KB about 931, and only the 500 KB limit leaves the full 4000 pixel width intact. For a passport-style photo, 500 to 900 pixels wide is plenty. For a document scan you want more, so use a higher limit if the form allows it.

Results on five ordinary photos

These five are smaller to begin with (0.14 to 0.87 megapixels), so the larger limits often do nothing at all. That is the right behaviour: a file that is already under the limit is returned unchanged rather than being degraded by a second compression.

PhotoOriginal20 KB target50 KB target100 KB target
Astronaut (512 x 512)97.0 KB19.8 KB at 398 x 398, 57%48.4 KB at 512 x 512, 82%already under, unchanged
Cat (451 x 300)49.0 KB19.5 KB at 451 x 300, 73%already under, unchangedalready under, unchanged
Coffee cup (600 x 400)102.3 KB19.9 KB at 508 x 339, 54%47.5 KB at 600 x 400, 80%99.1 KB at 600 x 400, 95%
Rocket (640 x 427)72.3 KB19.8 KB at 640 x 427, 60%49.0 KB at 640 x 427, 90%already under, unchanged
Deep-field image (1000 x 872)394.7 KB19.9 KB at 454 x 396, 58%49.4 KB at 798 x 696, 54%98.4 KB at 1000 x 872, 65%

All 25 runs on these five photos, and the five runs on the large photo above, finished under their target.

A checklist before you upload to a form

  1. Read the exact limit. Does it say "under 50 KB" or "between 20 and 50 KB"? If there is a minimum, do not go too far below it.
  2. Check the pixel dimensions. Some forms want a specific size such as 35 x 45 mm or 200 x 230 pixels. Resize first with the resize tool, then compress.
  3. How does the site count a kilobyte? Most count 1 KB as 1024 bytes, which is what our tools use. A few count 1000. If your form says 20 KB and rejects a file that shows 19.8 KB here, set the target to 19 KB and try again.
  4. Use JPG. The output is always JPG, which every upload form accepts. If your original is a PNG with a transparent background, the transparent part turns white.
  5. Look at the result before you submit. Zoom to 100% and check that a face or signature is still clear.

If the result looks too blurry

  • Pick the highest limit the form allows. Going from 20 KB to 50 KB lets the tool keep far more detail.
  • Crop the photo to just the face or document before you compress. Fewer pixels of background means more of the budget goes to what matters.
  • Retake the photo in good light. Noisy, dark photos compress badly, because the noise looks like detail to the encoder.

Privacy

Passport photos, signatures and ID cards are exactly the files you do not want on a stranger's server. The search for the best quality runs in your browser on your own device, so the image is never uploaded. You can confirm it by switching off your internet connection after the page loads and compressing a file anyway.

Compress to 20 KBGet an image under 20 KB — free, no upload
Compress to 50 KBGet an image under 50 KB — free, no upload
Compress to 100 KBGet an image under 100 KB — free, no upload
Compress to 200 KBGet an image under 200 KB — free, no upload
Caveat: the large photo is a simulation made from a real photograph, and the five photos are small. Real phone photos vary; the tool reports the dimensions and quality it used for every file, so you can check your own result.

Tools mentioned in this article

More from the blog

We checked all 28 image conversions pixel by pixel
28 conversions, each run in headless Chromium and compared against an independent decoder. What is identical, what is lossy, and why.
4 min read
How big will your image PDF be? We measured it
Page size does not change the file size, but quality does, a lot. Measured PDF sizes from JPG and PNG sources.
4 min read
JPG vs WebP quality settings: what each level really costs in file size
Nine quality settings, two formats, five photos, measured. Where the file-size curve is gentle, and where it falls off a cliff.
4 min read
PNG vs JPG vs WebP: what we measured on photos, screenshots, text and charts
There is no best format, only a best format for each kind of image. Measured sizes and quality scores for photos, screenshots, text and charts.
4 min read
Resize or compress first? Measuring what actually shrinks an image
Image size scales with pixel count, so resizing beats lowering quality. Here are the measured numbers, and the order that works best.
4 min read
Writing a real PNG compressor in vanilla JavaScript (no WASM, no libraries)
Median-cut quantization, Floyd–Steinberg dithering, hand-built PNG chunks, and the four browser traps that cost me an evening each.
6 min read
Are online image converters safe? What actually happens to your files
Most converters upload your file to a server you know nothing about. Here's how to tell which ones do, and when it actually matters.
6 min read
JPG vs PNG vs WebP vs AVIF: which image format should you use?
Five formats, one decision. Here's what each one is actually good at, with a rule of thumb you can apply in ten seconds.
6 min read
How to combine multiple images into one PDF
Every method, on every device — plus the page-size and quality settings that decide whether your PDF is 200 KB or 20 MB.
5 min read
How to make a favicon: every size and format you actually need
Which sizes you actually need, the exact HTML to paste, and the three reasons a favicon usually fails to appear.
5 min read
How to reduce image file size without losing quality
Do these three things in the right order and a 4 MB photo becomes 80 KB with no visible difference. The order matters more than the tools.
6 min read
What is a WebP file, and how do you open one?
Why the internet keeps giving you files you can't open, how to open them anyway, and when WebP is actually the right choice.
5 min read