Compress an image to an exact size

Give it a photo and a number in KB. It finds the highest quality that fits underneath your limit — and keeps the full dimensions unless it genuinely cannot. Nothing is uploaded.

🔒 Your image never leaves this device
Original —
Compressed —

Why forms ask for a size in kilobytes

Almost every request to compress an image to an exact size comes from a form that will not accept it otherwise. Government portals, university applications, job sites and visa systems set hard byte limits — 20 KB for a signature, 50 KB for a passport photograph, 100 or 200 KB for a scanned certificate — and reject anything above them without explaining what to do about it.

Those limits exist because the systems behind them were built when storage was expensive and are rarely revisited. A modern phone photograph is between three and eight megabytes. A form asking for 50 KB is asking for roughly one percent of that, which is why simply "saving a smaller copy" never works.

How this reaches a number you choose

A JPEG's size is governed by a quality setting between 0 and 1, but the relationship is not linear and depends entirely on the picture: quality 0.6 might produce 40 KB for a plain document scan and 400 KB for a detailed landscape. There is no formula, so the only reliable method is to encode, measure, and adjust.

  1. The image is encoded at a middling quality and measured.
  2. If it fits, quality goes up; if it overshoots, quality comes down. This repeats seven times, halving the remaining range each time.
  3. That converges on the highest quality that still fits underneath your target, to within about half a percent.
  4. Only if no quality setting reaches the target do the dimensions come down a step, and the search runs again.

The order matters. Reducing dimensions first is the easy way to hit any target, but it hands back a small blurry picture when a slightly softer full-size one would have been accepted. Quality is spent first for the same reason a photographer stops down before reaching for a smaller sensor.

The result is always under your target, never exactly on it. A limit of "maximum 100 KB" is satisfied by 96 KB, and padding a file out to hit 100 KB precisely would only waste the difference. If a form demands a size range — some ask for 20–50 KB — set the target to the top of the range.

Which format to choose

FormatCompressionUse it for
JPEGLossy, adjustablePhotographs, scans, anything from a camera. The only format that can hit an arbitrary size target.
PNGLossless, fixedScreenshots, logos, diagrams, line art. Sharp edges and flat colour survive; photographs stay large.

If a form does not say which it wants, send JPEG. It is the format these systems were built around, and it is the only one where a size limit is reliably reachable.

Typical limits, and what survives them

LimitCommonly asked forWhat you can expect
10–20 KBSignaturesFine. A signature is black ink on white and compresses extremely well.
50 KBPassport photographsComfortable at passport dimensions. Full-frame phone photos will be resized.
100–200 KBCertificates, ID scansUsually keeps full dimensions with a modest quality reduction.
Under 10 KBThumbnails, some older portalsExpect visible artefacts, and expect the dimensions to come down.

Getting a better result

Working with a document rather than a photo? If what you actually have is a multi-page PDF, compressing it as a PDF gives a far better result than turning it into images first — compress a PDF to an exact size instead.

Common questions

Does it really hit the exact size I ask for?

It gets as close underneath your target as it can without going over, which is what an upload limit actually requires. A 100 KB target typically lands in the high 90s. It will not pad a file out to hit the number precisely - a smaller file is never a problem for a form that says "maximum 100 KB".

Will it shrink the photo’s dimensions?

Only if it has to. Quality is reduced first, because most forms want the picture to still be legible at full size. Dimensions are only reduced when no JPEG quality setting reaches your target, and the result tells you if that happened.

Why is my PNG barely getting smaller?

PNG is lossless - it has no quality dial to turn down, so the only way to make it smaller is to reduce its dimensions. For photographs, switch the output to JPEG, which is what portals expect anyway. PNG is the right choice only for screenshots, logos and line art.

My photo came out sideways on other tools. Will it here?

It should not. Phone cameras record rotation as EXIF metadata rather than rotating the pixels, and tools that ignore it produce sideways images. This one applies the orientation before compressing.

Is my photo uploaded anywhere?

No. The compression runs in your browser using the same canvas your device already uses to display the image. Nothing is sent to a server, which matters here because the images people resize are usually passport photos, signatures and ID documents.

The result came back larger than the original

That means the file was already well optimised, so re-encoding it could only add bytes. When that happens your original is returned unchanged rather than a worse, bigger version of it.

Other tools

Compress a PDFThe same exact-size approach, applied to documents. Images to PDFTurn your compressed photos into one PDF file. All toolsEverything on this site, in one list.