Compress Image to a Target Size
Pick a size limit such as 20, 50, 100 or 200 KB and get a JPG that fits under it at the highest quality that will. The tool lowers quality first and reduces the dimensions only if it must, and it counts a kilobyte as 1000 bytes, so the file passes however a form measures. Runs in your browser.
Last updated
How to compress an image to a specific size
Set the size limit
Pick 20, 50, 100, 200 or 500 KB, or type any limit from 10 to 5000 KB. You can set it before or after adding images.
Add up to five images
PNG, JPG, WebP and SVG are accepted, up to 25 MB each. Every image is fitted to the limit on its own, so one batch can mix large and small files.
Process and download
Each image is compressed in turn and the results download as JPG, in a ZIP if there are several. Every file comes in under the limit, or its card explains why it could not.
What this image compressor does
Never over the limit
Every attempt is measured and only kept if it is at or below the limit. If an image cannot fit without shrinking below 160 pixels, you get a clear message instead of a file the form will reject.
Quality first, size last
Quality is searched before the image is resized at all, so a photo keeps its full dimensions whenever the budget allows it.
Kilobytes counted safely
Upload forms disagree about whether a kilobyte is 1000 or 1024 bytes. Aiming under 1000 bytes per kilobyte passes both kinds of check.
JPG with a white background
Output is JPG, the format size-limited forms ask for. Transparent areas in a PNG are filled with white rather than turning black.
Location data removed
The JPG is written from scratch, so EXIF metadata from the original, including the GPS position a phone may have recorded, is not carried across.
Nothing is uploaded
The search runs in a background worker in your browser, encoding the image as many times as it takes. Your photo never leaves your device.
Frequently Asked Questions
How do I compress a JPG to 100 KB?+
How much will my photo be reduced?+
Why is the output a JPG and not a PNG?+
Can the file get bigger?+
What is the smallest limit it can reach?+
Is my photo uploaded anywhere?+
Format Comparison
| Feature Specification | target-size compression | Alternative |
|---|---|---|
| Hits a size limit | Always, or says it cannot | By trial and error |
| Keeps full dimensions when possible | Yes, quality is lowered first | Yes |
| Output format | JPG | Whatever you choose |
| Kilobyte definition | 1000 bytes, safe for both | Not applicable |
| Metadata | Removed | Depends on the tool |
Technical Overview & Specifications
Deep dive into target-size compression architecture and processing.
Show DetailsHide Details
Technical Overview & Specifications
Deep dive into target-size compression architecture and processing.
Platform Overview
Size limits on upload forms are rarely explained and never negotiable. A university application wants a photo under 50 KB, an exam portal wants a signature under 20 KB, a job site turns away anything over 200 KB, and the message when you miss is usually just that the file is too large. Most people get there by guessing a quality setting in an editor, checking the file size, and trying again. This page does the guessing for you: you give it the limit, and it finds the best-looking JPG that fits under it.
It works in a fixed order. First it tries a high quality, and keeps that if it already fits. If not, it searches between quality 92 and quality 50, halving the gap six times, for the highest setting that fits. Quality goes before anything else because a full-size photo at moderate quality looks better than a shrunken one at high quality. Only if quality 50 is still too large does it reduce the dimensions, by just enough to fit, and it stops rather than hand back an image less than 160 pixels across. The result is always a JPG, with any transparency filled white and metadata such as GPS location removed. Up to five images, each fitted separately, all in your browser.
How the size search works
Encoded file size cannot be worked out in advance, because it depends on what is in the picture: a photo of foliage and a plain wall of the same dimensions can differ in size tenfold. So the tool measures, by encoding. For any one image, file size rises steadily with the quality setting, which is what makes a binary search valid: encode at the midpoint, keep the upper half if the file fits and the lower half if it does not, and repeat. Six rounds narrow the answer to within about a sixtieth of the range between quality 50 and 92, close enough that the next step up would break the limit.
When even quality 50 is too large, the image has more pixels than the budget can pay for. JPG size grows roughly in proportion to pixel count, so the tool takes the square root of the ratio between the budget and the sizes it has measured, aims at a middle quality rather than the floor, shrinks by that factor with a small safety margin, and runs the quality search again at the new size. Every attempt is drawn onto a white background first, because JPG has no transparency. The whole loop runs in a background Web Worker so the page stays responsive, and the number of attempts is capped so that a difficult image ends with a message rather than spinning.