Compress an image to an exact size

Runs on your device · Your file never leaves your device.

Set the size you need — 100 KB, 200 KB, whatever the form demands — and the image is compressed to fit. Instead of nudging a quality slider and re-checking the file size, you give the target and get a file that meets it.

The compressor searches for the highest quality that still fits your limit, so a 100 KB target produces a file close to 100 KB rather than an over-compressed 6 KB smudge.

The encoders are MozJPEG for JPG, a palette quantiser with oxipng for PNG, and libwebp for WebP, and every result shows a measured quality score against the original, with the pixel size before and after.

Works with JPG, PNG, WebP and iPhone HEIC photos, one at a time or in a batch, entirely inside your browser.

How to compress an image to an exact size

  1. Add one photo or a whole batch.
  2. Either drag the quality slider, or type an exact size limit in KB and let the tool find the best quality under it.
  3. Compare the before and after previews.
  4. Download the result, or the batch as a ZIP.

Supported formats and limits

Input
JPG, PNG, WebP, HEIC
Output
Compressed JPG, PNG or WebP
Modes
Quality slider, or an exact KB target
Batch
Yes — many photos at once
Where it runs
In your browser; nothing uploaded

Not for: Enlarging or sharpening — compression only removes data; it never adds detail back.

How the tool reaches your size limit

The image is first encoded at the slider's quality. If that file already fits, it is kept: the limit is a ceiling, not a number to fill. If not, JPG or WebP quality is lowered first, at full pixel size, down to 45 for JPG or 40 for WebP, below which pictures visibly fall apart.

If that is still too big, the width and height are reduced in steps at a quality of at most 60, and once a size fits, quality is raised again as far as the budget allows. The slider is also the upper limit of this search, so leave it high for the best quality your limit can hold. As a safety margin, it works to 99% of the number you type.

Which output format to choose

JPG suits photographs. It has no transparency: transparent areas become white. Below quality 90, colour detail is stored at half resolution, which can blur the edges of thin coloured text in a screenshot; from 90 up it is kept in full.

PNG starts lossless. To shrink it, the number of colours is reduced, from 256 down to as few as 2, with more dithering (fine dot patterns) as the palette gets smaller. Screenshots, diagrams and logos survive this well; photographs usually come out much smaller as JPG. WebP keeps transparency while compressing like a photo format, which suits a cut-out picture that must also be small.

How to read the quality score

The score is SSIM, a standard measure of how well a picture's brightness structure survives. Both images are compared at the same working size, at most 1,024 pixels on the longest side, so a resized result is judged against what it replaces. From 98% it is labelled visually identical, from 95% small differences, from 90% visible softening, and below that clearly reduced.

A low score under a tight limit means the picture has more pixels than the budget can carry. Cropping to the part that matters first (/crop-image) spends the same budget on fewer pixels.

What the new file keeps and what it leaves out

The output is written from the pixels alone, so details stored inside the original, such as the date, camera model and GPS location, are not copied into it. If a HEIC file holds more than one image, only the first is used.

A government or visa size from the list scales the photo down to that authority's longest side, switches to JPG and, where the authority sets one, applies its file-size cap. It does not crop to the required shape or position a face; the visa photo maker at /visa-photo-maker does that.

Frequently asked questions

Are my files uploaded to a server?
No. This conversion runs inside your browser using your own device’s processing power, and the file is not uploaded. Once a tool has been used once (video, text recognition and background removal download their engine from this site the first time), it keeps working when your connection drops.
Why do upload forms ask for such small images?
Each form sets its own limit, and some set it in the hundreds of kilobytes. Typing the exact number from the form gives you a file under it, without guessing at quality percentages.
What if the image cannot reach my target?
Reducing the pixel dimensions as well as the quality gets you there. A large photo scaled down is far more readable at 50 KB than the same photo kept full-size and crushed.

Related tools

More in Images

This page in other languages: العربية · Deutsch · Français · Español · Русский · Português · 中文 · हिन्दी · Türkçe · עברית · فارسی · اردو · Bahasa Indonesia · বাংলা