CompressToFit

Compressing a photo for an online form

Exam, visa and job portals demand photos under 50KB, 100KB or 200KB with fixed dimensions. Here is how to hit the number without the photo becoming unusable.

Updated 6 min read

Government portals, exam registration systems, visa applications and job sites all share a habit: they demand a photograph under a specific small size — 20KB, 50KB, 100KB, 200KB — and they reject anything over it without explaining how much over.

Meanwhile the photo on your phone is 4MB. That is between 20 and 200 times too large, and getting from one to the other without destroying the photograph takes slightly more thought than dragging a quality slider.

Why the numbers are so small

These limits were set when they were reasonable and have mostly not moved. A form built around a 50KB JPEG was built when a 50KB JPEG was a normal photograph; phone cameras then caught up by a factor of a hundred and the forms did not change. The limit persists because changing it means changing a storage budget, a database column and a validation rule in a system nobody wants to touch.

So it is not negotiable, and arguing with it is not a strategy. The practical question is what to spend the 50KB on.

Two dials, and the order matters

A JPEG's size comes from two things: how many pixels it has, and how precisely each block of pixels is described. Most people reach for the second and ignore the first, which is backwards.

Pixels first. A 12-megapixel phone photo squeezed into 50KB has about 4 bytes for every thousand pixels. No quality setting makes that work — you get a smeared, blocky mess that happens to be 4000 pixels wide. The same 50KB spent on an 800×1000 image is about 60 bytes per thousand pixels, which is a perfectly decent photograph.

Then quality. Once the dimensions are sensible, quality is what fine-tunes the size. JPEG quality is not a percentage of anything meaningful — it is an index into quantisation tables — but in practice: above about 0.9 you are spending many bytes on detail nobody can see, below about 0.3 the blocking is obvious, and the useful range is in between.

So: resize to roughly what the form will display, then find the highest quality that fits.

What the form actually wants

Most portals specify dimensions alongside the size limit, and if yours does, use them — they are the answer to "how many pixels should this be". Typical photograph requirements sit between 200×230 and 600×600 pixels.

If only a size limit is given, these are reasonable starting dimensions:

Size limit Sensible dimensions Notes
20KB 300×400 Very tight; expect visible softness
50KB 450×600 Comfortable for a head-and-shoulders photo
100KB 700×900 Good quality, room to spare
200KB 1000×1300 Near-original quality for a portrait

A portrait photograph compresses well because faces are smooth gradients. A document scan with text at the same size is much harder, which is the next section.

If it is a scanned document, not a photo

Text is expensive. Sharp black-on-white edges are exactly the thing JPEG handles worst, and the artefacts show up as grey fringing around letters — which can make a scanned document genuinely illegible at sizes a photograph would survive.

Three things help:

  • Keep resolution, drop quality. The opposite of the advice for photographs. Text needs pixels to stay legible more than it needs precision in each pixel, so a larger image at lower quality usually reads better than a small one at high quality.
  • Scan in greyscale. A black-and-white document scanned in colour spends bytes describing colour noise in the paper.
  • If it is multi-page, make it a PDF instead. A PDF can be compressed losslessly, which keeps text as text. See compressing a PDF without losing its text.

The mistake that wastes the most time

Compressing repeatedly, in several passes, until the number is low enough.

Each JPEG save re-quantises the image, and the second pass treats the first pass's artefacts as real detail worth preserving. Five rounds of "save, still too big, save again" produces something visibly worse than one pass straight to the target — and often larger, because preserving artefacts costs bytes.

Always go back to the original and compress once. If a pass lands at 70KB against a 50KB limit, do not compress the 70KB file — go back to the 4MB original and aim at 50KB.

What a tool should be doing for you

This is the part worth knowing, because it is the difference between landing at 48KB and landing at 12KB.

An image encode takes about fifteen milliseconds. That is cheap enough that there is no reason for a tool to guess a quality setting — it can try one, measure the actual byte count, and adjust. Bisecting the quality range takes about eight attempts and converges to within a percent:

quality 0.92  →  180KB   over 50KB, go lower
quality 0.61  →   38KB   under, could go higher
quality 0.76  →   58KB   over
quality 0.68  →   47KB   under, and the best so far

The result is the highest quality that genuinely measured under 50KB — not an estimate, and not a preset that happened to be conservative. Tools that apply a fixed quality setting typically overshoot (rejected again) or undershoot badly (a 12KB photo when you were allowed 50KB, which is quality you were entitled to and did not get).

Compress an image to 50KB, to 100KB or to 200KB does exactly that, in your browser — and the image compressor itself takes any number you type. The photo is not uploaded anywhere — which, for a scanned passport or ID, is the other thing worth caring about.

FAQ

How do I reduce a photo to 50KB without it looking terrible?

Resize before you compress. A full-resolution phone photo at 50KB has far too few bytes per pixel to look like anything; the same 50KB spent on a 450×600 image is a perfectly good photograph. Resize to roughly the dimensions the form will display, then find the highest JPEG quality that fits under the limit — and do it in one pass from the original, not repeatedly.

What is the best format for a form upload?

JPEG, unless the form specifically asks for PNG. JPEG is universally accepted, and it has a quality dial that can be aimed at a byte target. PNG is lossless, which means its size is whatever it is — you cannot target 50KB with a PNG, you can only resize until it happens to fit. If your image has transparency that must survive, WebP is the better option where it is accepted.

Why does my image get rejected even though it is under the limit?

Usually dimensions or format rather than size. Many portals enforce minimum and maximum pixel dimensions alongside the byte limit, and some reject anything that is not a baseline JPEG — progressive JPEGs occasionally fail on older validators. Check the requirements for a dimension range, and make sure the file extension matches the actual format.

Does compressing an image remove its EXIF data?

Re-encoding usually drops most metadata, including location data, camera model and timestamps. That is generally desirable for a photo being uploaded to a portal. It is worth knowing if you were relying on the EXIF orientation flag — a re-encoded image should be physically rotated rather than depending on a flag that may not have survived.

Do it now, in this tab

Each of these opens the tool with the target already set. It runs on your own machine — nothing is uploaded, there is no watermark and no signup, and the output is measured before you get it.

Reference

The limits this guide refers to

Each number carries the date it was last checked against the platform's own documentation.