Images

How to Compress a Photo to 20KB, 50KB or 100KB Without Ruining It

Why upload forms impose kilobyte limits, how JPEG compression actually works, and the right order of operations to hit an exact file size while keeping your photo sharp.

8 min read · Updated

A form tells you the photograph must be under 50 KB. Your phone produces a 4.2 MB file. That is a reduction of roughly 99%, and the naive approach — dragging a quality slider to the bottom — produces a smeared, blocky mess. There is a better way, and it starts with understanding that file size is controlled by two independent levers, not one.

The two levers: dimensions and quality

Every JPEG's size is a product of how many pixels it contains and how aggressively those pixels are encoded.

  • Pixel dimensions — a 4000 × 3000 photo holds 12 million pixels. A 200 × 230 photo holds 46,000. That is a 260× difference in raw data before any compression is applied at all.
  • JPEG quality — a number from roughly 1 to 100 controlling how much detail the encoder discards. Quality 90 is visually indistinguishable from the original for most photographs; quality 30 shows obvious artifacts.

The critical insight: reducing dimensions is nearly free in perceived quality; reducing JPEG quality is not. A photo displayed at 200 pixels wide looks identical whether it came from a 4000-pixel original or a 200-pixel one. But at quality 25, it looks bad at any size. So you should always exhaust the dimension lever before touching the quality lever.

What JPEG compression actually discards

JPEG does not simply "lower the resolution". It splits the image into 8 × 8 pixel blocks, converts each block from pixel values into frequency components, and then throws away the high-frequency components — the fine detail — more aggressively as quality drops. It also stores colour information at lower resolution than brightness, because human vision is far more sensitive to luminance than to hue.

This explains the artifacts you see when you compress too hard:

ArtifactWhat it looks likeWhy it happens
BlockingVisible 8 × 8 squares, especially in smooth areas like sky or a plain backgroundToo few frequency components retained per block
RingingFaint halos or ripples along sharp edges, particularly around textHigh-frequency detail needed for a clean edge has been discarded
Colour bleedingColour smearing past object boundaries, worst on red and orangeChroma stored at half or quarter resolution
BandingStripes across a gradient instead of a smooth transitionQuantisation steps become coarse enough to see

Notably, flat areas compress extremely well and busy areas compress badly. A headshot against a plain white wall will reach 20 KB far more gracefully than the same face in front of a bookshelf. This is a practical reason to shoot against a plain background beyond the fact that most forms require it.

The correct order of operations

Doing these steps out of order is the single most common cause of a photo that is both the right size and unusably ugly.

  1. Start from the original. Not from a WhatsApp copy, not from a screenshot, not from a file you already compressed once. Every re-encode compounds the damage — compressing an already-compressed JPEG is called generation loss and it is cumulative and irreversible.
  2. Crop to the required aspect ratio. Removing pixels you do not need is the cheapest possible size reduction, and it improves the composition at the same time.
  3. Resize down to the target dimensions. If the form allows a range, pick the lower end.
  4. Convert to JPEG if you are not already there. PNG is a poor choice for photographs — see below.
  5. Compress to the target size, adjusting quality until you land just under the limit.

Why your PNG is enormous

PNG is lossless — it reproduces every pixel exactly — and it compresses by finding repeated patterns. That works brilliantly for screenshots, logos, line art and anything with large areas of flat colour. It works terribly for photographs, where essentially every pixel differs slightly from its neighbours and there are no patterns to exploit.

Typical file size for the same 1000 × 1000 image
Content typePNGJPEG (quality 85)WEBP (quality 85)
Photograph of a face~1.4 MB~110 KB~75 KB
Screenshot of text~90 KB~180 KB~60 KB
Flat-colour logo~12 KB~65 KB~9 KB

The numbers vary with content, but the pattern is reliable: photographs belong in JPEG or WEBP; graphics and screenshots belong in PNG or WEBP. If a form limits you to 20 KB and you are working with a PNG photograph, converting to JPEG is not an optimisation — it is the whole solution.

Hitting an exact target size

There is no formula that converts "quality 78" into "37 KB", because the answer depends entirely on image content. Compressors that offer a target-size mode work by binary search: encode at quality 50, measure, adjust up or down, encode again, repeat until the result lands within tolerance. Our Image Compressor does this automatically — you type the target in KB and it converges on it, dropping resolution only if quality alone cannot get there.

When you are aiming at a band rather than a ceiling — 20–50 KB, say — aim for the middle. Landing at 20.4 KB is technically compliant but leaves no margin if the portal re-encodes on its end, and some validators measure size slightly differently than your file manager does.

Realistic expectations by target size

TargetAchievable atNotes
200 KBFull quality, 1200 × 1600Comfortable. No visible compromise.
100 KBQuality ~85, 800 × 1000Still looks good on screen and in print at passport size.
50 KBQuality ~80, 413 × 531Fine for a form photograph. Plain background helps a lot.
20 KBQuality ~75, 200 × 230Works because the image is small. Do not attempt at full resolution.
10 KBQuality ~80, 140 × 60Realistic for a signature (mostly white). Not for a face.

If you are being asked for 20 KB at 1000 × 1000 pixels, something is wrong with your reading of the specification — that combination requires quality settings low enough to be visibly broken. Re-check the notification.

Signatures are a different problem

A signature is dark strokes on white paper — almost entirely flat area with a small amount of high-contrast detail. That is the worst case for JPEG, which produces visible grey halos around the strokes, and the best case for PNG, which stores the flat white almost for free.

Unfortunately most portals demand JPEG. The workaround is to make sure the white is actually white before you compress: a scan with a light grey cast gives JPEG a lot of low-level noise to encode. Raise the contrast until the background is pure white and the strokes are solid, and the file will compress dramatically better and look cleaner doing it. The Image Editor has brightness and contrast controls for exactly this.

Batch compression

If you are preparing a set of documents — marksheets, certificates, ID scans — compress them as a batch rather than one at a time. Consistent settings across the set means consistent appearance, and you avoid the mistake of applying a signature-appropriate quality to a photograph. Our compressor accepts multiple files and returns them as a ZIP.

Frequently asked questions

Does compressing an image reduce its pixel dimensions?

Not inherently. Compression and resizing are separate operations. Compressing at fixed dimensions lowers quality; resizing lowers the pixel count. Tools with a target-size mode may do both, reducing dimensions only when the requested size is unreachable through quality alone.

Can I get the quality back after compressing?

No. JPEG compression permanently discards data. There is no recovery, which is why keeping an untouched original matters more than any other habit in this guide.

Why did compressing my image make it bigger?

Almost always because you compressed a PNG and kept it as PNG, or because you re-saved a JPEG at a higher quality than it was originally encoded at. Re-encoding at quality 95 a file that was already saved at quality 70 adds bytes without adding detail.

Is 80% quality the right setting?

It is a good default for photographs — most people cannot distinguish quality 80 from the original at normal viewing size. Below about 60 artifacts become noticeable on faces; above about 92 you pay a large size penalty for a difference nobody can see.

Should I use WEBP instead of JPEG?

For your own website or storage, yes — WEBP is typically 25–35% smaller at equivalent quality. For a government or exam portal, no. They almost universally accept only JPEG, and an unrecognised format is a guaranteed rejection.

Do these tools upload my photo to a server?

Ours do not. All compression here runs in your browser using the Canvas API, so the image data never leaves your device. Many competing sites do upload — worth checking before you hand over an ID scan.

Tools used in this guide

  • Image Compressor — Compress images to a target KB/MB, percentage or quality while keeping maximum quality.
  • Image Resizer — Resize by width, height, pixels or percentage with lock aspect ratio, fit, fill & padding.
  • Form Photo & Signature — Make photos & signatures fit exam / job form rules — exact pixel dimensions and an exact KB size range, at the best possible quality.
  • Image Converter — Convert JPG, PNG, WEBP, AVIF, HEIC, BMP, TIFF, GIF, SVG & ICO. Bulk conversion with ZIP download.

Related guides