Compress an image to a target size
Choose a photo, pick the size you need (forms often ask for under 20, 50, 100 or 200 KB) and press Compress. The image is processed on your device and never uploaded.
How it works
Your browser opens the image and draws it onto an invisible canvas. It then saves the canvas as a JPEG or WebP file at a chosen quality and checks the file size. To find the best quality that still fits, it uses a binary search: it tries the highest quality (92%) first; if that is too big it tries the lowest allowed (30%), then keeps halving the gap between a quality that fits and one that does not, for up to 8 tries. The result is the highest quality it found that is at or under your target.
If even 30% quality is too big, and resizing is allowed, it reduces the width and height and searches again. File size grows roughly with the number of pixels, so it scales each side by about √(target ÷ current size), with a 10% margin, but never by less than 0.3 or more than 0.9 in one step. It repeats this (up to 8 rounds) until the target is reached.
scale = √(target size ÷ size at 30% quality) × 0.9, kept between 0.3 and 0.9
Worked example
A 4,000 × 3,000 pixel phone photo is often 3–5 MB. Aiming for 100 KB, even 30% quality at full size is far too big, so the tool shrinks it: if the 30% version is 1.2 MB, √(100 ÷ 1,200) × 0.9 ≈ 0.26, which is below the 0.3 limit, so each side is scaled by 0.3 to 1,200 × 900 pixels and the quality search runs again at that size. If that is still too big, it shrinks again. The exact result depends on the photo: busy, detailed scenes need more bytes than plain backgrounds.
If you set a maximum width (for example 1,200 pixels for a website), the image is resized to that first, which usually lets it keep a higher quality.
What "KB" means here
Targets use 1 KB = 1,000 bytes. Some sites mean 1,024 bytes; a file under 100 × 1,000 bytes is under both, so the result fits either way.
Assumptions and limits
- Transparency: JPEG has no transparency, so transparent areas (common in PNG logos) become white. Choose WebP to keep them.
- Metadata: the new file does not carry over the original's metadata such as camera details and GPS location, which is usually good for privacy.
- Animation: only the first frame of an animated GIF or WebP is kept.
- WebP support: some older browsers cannot save WebP; the tool tells you if so, and JPEG always works.
- Very large images (above about 50 megapixels) may be too big for a phone's memory.
FAQ
Is my photo uploaded?
No. Everything happens inside your browser on your device. You can turn off your internet connection after the page loads and it still works.
Why does a smaller target look blurrier?
To save space, JPEG and WebP throw away fine detail. Lower quality and fewer pixels both mean less detail. For a passport or ID photo upload, check that the face is still sharp before you submit it.
Can I compress a PDF or several files at once?
Not with this tool. It handles one image at a time.