Image Compressor
Shrink JPG, PNG, WebP and AVIF images with a quality slider, or aim for an exact file size such as 200 KB, and compare the result against the original before you download. The image is re-encoded on your own device and never uploaded.
Runs entirely in your browser — nothing is uploaded
Drop images here to compress
JPG, PNG, WebP, GIF and AVIF. Add several at once if you like.
75% is usually indistinguishable from the original. Below 50% starts to show blocking around edges and text.
Resizing shrinks a file far more than quality alone. A 4000 px photo shown at 800 px wide is wasting nine tenths of its data.
How to use it
- Drop one or more images onto the box above, or click Choose files.
- Pick how to compress: a Quality percentage, or a Target file size to aim for. For a target, click one of the common sizes or type the exact number you have been given — 198 KB is as valid as 200 KB.
- Optionally set a maximum width or height — for anything web-bound, 1920 px is usually more than enough and saves far more than quality alone.
- Press Compress, then check the before/after panels and download the result.
Click any row in the list to see that image in the comparison panels.
How it works
Your browser already contains fast, well-tested image codecs — it needs them to display images at all. This tool borrows that machinery. The file is decoded into a bitmap, drawn onto an off-screen canvas (resized at this point if you asked for a maximum dimension), and then re-encoded at the quality you chose. The work runs in a Web Worker, which is why the page stays responsive while a large photo is processed.
In quality mode this is a single pass: one encode at the quality you set.
Target size mode is a search. Encoded size rises with quality in a predictable way, so the tool bisects: it encodes at 95 per cent quality, and if that already fits, you keep it. Otherwise it encodes at the 30 per cent floor to check the target is reachable at all, then halves the interval repeatedly — eight steps pin the quality down to a fraction of a per cent. It stops as soon as the result is within 5 per cent of your target, which is why you get 194 KB for a 200 KB request rather than 60 KB.
The 30 per cent floor is the part that protects the image. If even that overshoots, quality is not pushed lower; instead the dimensions come down and the search runs again on the smaller canvas. How far down is calculated rather than guessed — a JPEG’s size tracks its pixel count, so the linear factor needed is roughly the square root of how far over the target you are, which usually lands it in one shrink. PNG is handled differently again: being lossless it has no quality knob, so the same bisection runs on the scale instead.
If a target genuinely cannot be met — below about 30 per cent quality at 32 pixels on a side — you are told, rather than handed something unusable. And if your file is already under the target, it is returned untouched instead of being re-encoded for nothing.
Two consequences of the canvas route are worth knowing. Metadata does not survive, because the output is built from pixels rather than copied from the source — so EXIF, including GPS coordinates, is dropped. And the process is lossy even at 100 per cent quality if the source was a JPEG, because decoding and re-encoding a JPEG always loses a little. If you need a guaranteed byte-for-byte identical image, do not compress it.
Tips
- Judge quality on the downloaded file at 100 per cent zoom, not on the preview. Scaled-down previews hide compression artefacts almost perfectly.
- Combine a maximum dimension with a moderate quality setting rather than pushing quality very low. 1920 px at 75 per cent looks dramatically better than 4000 px at 30 per cent, and is usually smaller too.
- Screenshots of text and UI compress badly as JPEG — the sharp edges produce visible ringing. Keep them as PNG, or use WebP.
- If the badge says “no gain”, the image was already well compressed. Keep your original.
- A target larger than the file you dropped in is not an instruction to inflate it. The file comes back untouched, badged “already small enough”.
Frequently asked questions
Are my photos uploaded anywhere?
Does compressing strip EXIF and location data?
How much smaller will my image get?
What quality setting should I use?
Quality slider or target file size — which should I use?
Can I set an exact size like 198 KB?
Why is resizing more effective than compressing?
Which format should I choose for the output?
Is there a file size or file count limit?
Why can I not compress a HEIC photo from my iPhone?
Does it work with animated GIFs?
Related tools
Image to PDF
Turn one or many images into a single, tidy PDF document.
Compress PDF
Shrink a PDF by re-encoding the images inside it, with a quality setting you control.
PDF to Image
Export each page of a PDF as a JPG or PNG image file.
Browse every tool in Image Tools.
Found a bug or want a feature? Tell us — ToolStash is built from user requests.