CompressPictureCompress an image

Compress an image to a size in KBHit the exact size your form asks for

Pick a limit like 50 KB and get the best-looking photo that fits under it.

A photographer sliding landscape prints into a paper envelope on a wooden desk — the compressed copy, which looks the same as the original.Looks the same
studio-prints.jpg261 KB261 KB down to 49.8 KB−81%
Fits a 50 KB upload limit
or drop it here · paste works tooJPG, PNG, WebP, GIF or HEIC · up to 120 MB

No photo handy?

Free · No sign-up · Photos stay on your device

Cap to aim for

Set it now or after opening. Photograph and signature fields usually sit in the 20 to 50 KB band; each body publishes its own figure, so read the form.

Type the cap the form gave you. Eight encodes at most, in a worker, and the largest file that fits underneath it — or a straight answer that the format cannot get there.

How the search finds the number

There is no formula that turns a byte target into a quality setting. The relationship depends on the picture: a photograph of a wall and a photograph of a forest at the same dimensions and the same quality differ by a factor of five. The only reliable way to hit a cap is to encode, measure and encode again.

  1. 1The first trial is the floor — JPEG quality 5, or a two-colour palette. If the floor is still over your cap, no setting on that axis will fit, and you are told so after a single encode.
  2. 2If the floor fits, it becomes the answer to fall back on and the search bisects upward, each trial taking the half of the range that is still worth looking at.
  3. 3For a PNG there is one extra trial before all of that: the lossless pass. If the file fits under the cap without a pixel changing, the search stops there, because nothing improves on that.
  4. 4The search stops after eight encodes or when the range closes, whichever comes first, and returns the largest file it found under the cap.

All of it runs in a worker. Eight full re-encodes of a twelve megapixel photograph on the main thread is a frozen tab; here the page keeps drawing and the trial list fills in as each one lands.

When the cap cannot be met

A cap is unreachable when the picture has more pixels than the cap has room for. Twenty kilobytes across four thousand by three thousand pixels works out at one byte for roughly every six hundred of them, and no JPEG encoder writes a photograph that thin without turning it into blocks.

At that point this page stops and tells you the smallest file it could make. The next step — reducing the long edge — changes the picture's dimensions rather than its bytes, so it happens only when you say so: press the button that names the dimensions, or switch on “Allow smaller dimensions” before the run. This tool never quietly makes a picture smaller to make a number look right.

The format step is offered, never taken for you.

When the floor still overshoots, the panel lists what can still give, cheapest change first: the MozJPEG encoder if the browser's writer was running, 4:2:0 chroma if you had chosen 4:4:4, a more efficient format (WebP or AVIF), and only then fewer pixels. Each is one click and none is applied on its own. On a form route, or with an upload spec chosen, the format rung is left out: a portal that asks for a JPG will refuse a WebP.

Kilobytes, and which kilobyte

  • A kilobyte is counted as 1,024 bytes by default, and the exact byte figure is printed beside the control. A switch under the cap counts 1,000 instead, for forms that say so.
  • Upload forms are inconsistent about this, so the stricter reading is the default: a file under the cap at 1,024 bytes to the kilobyte is also under it at 1,000.
  • The search aims 2% under the cap unless you move the margin, because a file a few bytes under a limit is one rounding away from being over it.
  • The size a form checks is the size on disk. It does not care what the picture looks like or what it once weighed, which is why the result here is the file itself rather than an estimate of one.

Questions people arrive with

Why is the result 18.6 KB when I asked for 20 KB?
Two reasons. File size moves in steps as quality moves, and the search returns the largest file that is still under the number rather than one exactly on it. And by default it aims 2% under your cap, so a file that a portal measures slightly differently still passes; the margin is a slider from 0 to 10%. An upload form checks for at most 20 KB. A file at 18.6 KB passes that check; a file at 20.1 KB does not.
Is a kilobyte 1000 bytes or 1024 here?
1,024 by default: a 50 KB cap is treated as 51,200 bytes, and the exact byte figure is printed next to the control. Portals differ on which they mean, and 1,024 is the stricter reading for a cap — a file under it also passes a form that counts 1,000. When a form says it counts 1,000 bytes to the kB, switch the kilobyte under the cap and the byte figure changes with it.
What happens when the cap cannot be reached?
The tool stops and reports the smallest file the format can produce at those dimensions, along with the setting that produced it. It then offers a reduction of the long edge, with the dimensions it would produce shown before you agree, and there is a switch — off unless you turn it on — that lets the search reduce the long edge itself. It will not quietly make the picture smaller to hit a number.
How many times does it encode my file?
Eight at most per size. The first trial is deliberately the format's floor, so a cap that is out of reach is reported after one encode instead of eight; if the floor fits, the remaining trials climb back up looking for the best setting that still fits. Every trial is listed with its size as it lands, and marked on the size ruler above the picture. If you allow smaller dimensions, each reduced size gets its own search, four sizes at most.
The form wants 20 KB and also a fixed pixel size. Which do I do first?
Pixel dimensions first, then the byte cap — and the photo resizer in KB on this site does both in one run, in that order. Setting the dimensions after the byte cap re-encodes the file and changes its size, which puts you back over the cap. The exam-portal guide works through the order in full.

Elsewhere on this site