Compress Image to a Target Size
Squeeze any image down to an exact KB budget. Free, fast, and your files never leave your device.
Drop an image here or click to choose a file
JPG, PNG or WebP. We resample quality until you hit the target.
Original
Compressed
How the quality setting is chosen
There is no direct relationship between a quality number and a file size. The same setting of 0.7 might give 90 KB on a portrait against a plain wall and 900 KB on a photo of autumn leaves, because detail and noise are what cost bytes. The only reliable way to hit a size is to encode, measure, and try again.
That is what this page does. It first encodes at quality 0.05, the floor, to see whether your target is achievable at all. If even that floor is bigger than your budget, it hands you that smallest version and tells you the target was out of reach. Otherwise it runs a binary search between 0.05 and 1.0 over eight rounds, halving the search range each time, always remembering the highest quality that still fits under your number. Nine encodes in total, and you get the best-looking file that satisfies the limit rather than a file that is needlessly smaller than it needed to be.
Eight rounds narrow the quality setting to within about four thousandths, which is far finer than anyone could tell by eye. The compression itself is done by the browser's own JPEG and WebP encoders. Everything runs in your browser, so your files never leave your device. Nothing on your disk is altered.
A run from start to finish
Take a 2.4 MB photo straight off a phone, 4032 x 3024 pixels, and a form that will not accept more than 200 KB. Set the target to 200, leave the format on JPEG, and press the button.
The floor encode comes back in the low tens of kilobytes, so the target is clearly reachable and the search begins. It tries the midpoint, finds it too large, halves downward, finds one that fits, edges back up, and settles on a quality somewhere in the region of 0.5 to 0.7 for a photo of that kind. The result lands just under 200 KB, typically within a few kilobytes of it, at the original 4032 x 3024 resolution. Viewed at full screen you will see some softening in fine foliage and a little blockiness in flat sky. Viewed at the size a form or a document actually displays it, it looks fine.
The before and after thumbnails on this page are capped at 180 pixels wide, which is far too small to judge artefacts. Download the file and open it properly before you submit it anywhere that matters.
Is a kilobyte 1024 bytes or 1000?
This tool treats one kilobyte as 1024 bytes, so a target of 200 means 204,800 bytes. Plenty of upload forms use the decimal meaning and cap you at 200,000 bytes instead. If you are up against a strict limit, set the target about five per cent below the stated number. Asking for 190 when the form says 200 KB costs you almost nothing in visible quality and removes the argument entirely.
When compression alone will not get you there
The resolution is never changed here. A 12 megapixel image stays 12 megapixel, and all the saving has to come out of quality. That works down to a point. Below roughly 50 KB for a full-size phone photo, JPEG starts producing visible blocks and colour smearing, and the file looks bad at any size.
The fix is to shrink the pixel dimensions first. Halving both sides quarters the pixel count, and a 1500 px wide version of a photo at quality 0.8 will look dramatically better at 100 KB than a 4032 px version squeezed to the same 100 KB. Use the image resizer first, then come back here. For very tight government form limits, our guide to compressing photos for online forms walks through the order of operations.
Traps to watch for
Transparency does not survive. Neither output format is being given a background colour here, and when a canvas holding transparent pixels is encoded as JPEG those areas usually render black rather than white. If your source is a PNG logo with a transparent background, flatten it onto white first in the image converter, which paints the canvas white before encoding.
WebP holds detail better than JPEG at the same file size, so pick it when you have the choice. Many upload forms do not accept it, so check before you commit. Metadata is also gone: re-encoding through a canvas drops EXIF, so capture dates and GPS coordinates disappear along with the bytes.
If you already know the exact budget you need, the fixed-target pages skip the typing: 100 KB and 500 KB do the same job with the number already filled in.
Questions
Why is my result 196 KB and not exactly 200 KB?
The search only keeps results at or under your target, and quality steps do not map to byte-perfect sizes. Landing a few kilobytes short is expected and is safer than overshooting.
Does it reduce the width and height as well?
No. Pixel dimensions are preserved exactly and only the encoding quality changes. Resize separately if you need smaller dimensions.
The form still rejected my file. Why?
Most likely a kilobyte definition mismatch, or a format restriction. Try a target five per cent under the stated cap, and make sure the form accepts the extension you produced.
Can I get a PNG out of it?
No. PNG has no quality dial to search over, so only JPEG and WebP are offered. A PNG input is perfectly welcome, it just comes back in one of those two formats.
What happens if I ask for something impossible, like 5 KB?
You get the smallest file the encoder can make at its lowest quality setting, along with a message saying the target was too small. Reduce the resolution first and try again.