Compress image to size
How it gets the size right
A JPEG or WebP file gets smaller as the quality setting goes down. This tool finds the highest quality setting that still fits under your limit using a binary search: it tries a middle setting, checks the file size, then keeps searching the half that can work. About seven tries pin it down.
If your photo has so many pixels that even a low quality setting is too big, the tool reduces the pixel size a little and searches again. Large photos often need this for limits of 50 KB or less. Turn the option off to keep the original dimensions.
Good to know
- Everything happens in your browser. Your photos are never uploaded.
- The tool counts 1 KB as 1,000 bytes, so results pass strict upload forms.
- A file that is already under your target and already in the chosen format is kept unchanged.
- Phone photos keep their correct orientation.
Questions
Is my image uploaded anywhere?
No. Your own browser compresses the image. Nothing is sent to a server, and the tool keeps working if you turn off your internet after the page loads.
Why is the result a little smaller than my target?
The tool searches for the highest quality that still fits under your limit, so the result lands just below it. It also counts 1 KB as 1,000 bytes, which makes the file pass whether a website counts 1 KB as 1,000 or 1,024 bytes.
What if the target is too small for my photo?
With the resize option on, the tool reduces the pixel dimensions until the file fits. With it off, you get the smallest file possible at the lowest quality and a warning that the target was not reached.
Why do PNG files become JPEG?
PNG is lossless, so a quality setting cannot shrink it to an exact size. Converting to JPEG or WebP lets the tool control the size. Transparent areas become white in JPEG.
Which files can I use?
JPG, PNG, WebP, GIF, BMP and AVIF, as long as your browser can open them. HEIC photos from iPhones open in Safari; in other browsers, convert them to JPG first.