Skip to content
ToolStash

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.

Compress by

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

  1. Drop one or more images onto the box above, or click Choose files.
  2. 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.
  3. 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.
  4. 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?
No. Your browser decodes the image, redraws it onto an off-screen canvas, and re-encodes it — all on your device, in a background worker thread. Nothing is transmitted. This matters more for photos than for most files, because a photo straight off a phone carries EXIF metadata including GPS coordinates, the exact timestamp and a camera identifier.
Does compressing strip EXIF and location data?
Yes, as a side effect of how the pipeline works. Re-encoding through a canvas produces a new image from pixels alone, so EXIF — including GPS coordinates — does not carry over. If you are posting a photo publicly, that is a useful privacy win. If you specifically need the camera data kept, keep your original alongside the compressed copy.
How much smaller will my image get?
A photo straight from a phone camera typically drops 60–85 per cent at 75 per cent quality with no visible difference. Screenshots and graphics with flat colour and text behave differently: they compress poorly as JPEG and often better as PNG or WebP. An image that has already been compressed once may barely shrink at all — the tool tells you when the output is no smaller than the input rather than handing you a pointless file.
What quality setting should I use?
75 per cent is the sweet spot for photographs and is where most websites sit. 85 to 90 per cent is worth it for images with fine detail or text you will zoom into. Below 50 per cent you will start to see blocky patches in smooth areas like skies and halos around sharp edges. Judge it at full size, not from the preview thumbnails — a shrunken preview hides exactly the artefacts you are looking for.
Quality slider or target file size — which should I use?
Use the quality slider when you want a consistent look and do not mind where the file size lands. Use target size when something imposes a hard limit — a job portal capping uploads at 200 KB, a government form at 500 KB, a forum at 2 MB. Target mode aims to land just under the number rather than merely somewhere below it: it searches for the highest quality that still fits, and if that would mean pushing quality below 30 per cent it reduces the pixel dimensions instead. A 200 KB target on a 12-megapixel photo therefore comes back as a smaller sharp image rather than a full-size mushy one.
Can I set an exact size like 198 KB?
Yes. The buttons cover the sizes that come up most often — 200, 400, 600, 800 and 1000 KB — and the box beside them takes any value from 1 KB upwards, so 198 KB or 350 KB is just as easy. The result is reported as a percentage of your target so you can see how close it landed; in practice it arrives within a few per cent, under the limit rather than over it. A kilobyte here is 1024 bytes, matching what your operating system shows.
Why is resizing more effective than compressing?
Because file size scales with the number of pixels. Halving both dimensions removes three quarters of the pixels before compression even begins. A 4000-pixel-wide photo displayed in a 800-pixel-wide column is carrying twenty-five times more data than the screen can show. If the image is destined for a website, set a maximum dimension of 1920 px and you will often get a bigger saving than any quality setting alone.
Which format should I choose for the output?
Keep the original format if you are unsure. Choose JPEG for photographs with no transparency — it is the smallest and works everywhere. Choose WebP when you need transparency at a small size, or want roughly 25–30 per cent better compression than JPEG; every current browser supports it. Choose PNG only when you need lossless output, such as a screenshot with crisp text or an image you will edit further. Converting a transparent PNG to JPEG flattens the transparent areas onto a solid background, so the tool warns you before that happens.
Is there a file size or file count limit?
No limit we set, and no daily cap. You can add several images at once and compress them in one pass. The real constraint is your device’s memory, since everything happens in the tab: very large images can exceed the browser’s internal canvas limits, which is roughly 16,384 pixels on a side on desktop and lower on iOS. If a huge image fails, set a maximum dimension of 4000 px or less and it will go through.
Why can I not compress a HEIC photo from my iPhone?
Browsers cannot decode HEIC — Apple’s format is not supported by the built-in image codecs, so there is nothing for the canvas to draw. Converting HEIC needs a dedicated decoder, which is a separate tool on the list. In the meantime, sharing the photo from your iPhone or emailing it to yourself usually converts it to JPG automatically, and that JPG compresses here fine.
Does it work with animated GIFs?
Not as animations. The canvas pipeline reads a single frame, so an animated GIF comes out as a still image of its first frame. The tool warns you when it spots a GIF. For genuinely optimising an animation you need a GIF-specific tool.

Browse every tool in Image Tools.

Found a bug or want a feature? Tell us — ToolStash is built from user requests.