Image Compressor

Re-encode a JPEG, PNG or WebP in your browser and compare the sizes. Lossy formats trade a little detail for a smaller file.

Drag & Drop Image Here

Supports PNG, JPEG, and WebP

How the compression works

The tool draws your image onto an HTML canvas and asks the browser to encode it again with canvas.toDataURL(), passing the slider position as the quality value (10 to 100 on the slider becomes 0.1 to 1.0). MDN notes that this value only applies to formats with lossy compression, such as JPEG and WebP. That single fact explains most of what you will see.

For a sense of scale, one test with an 800 by 600 pixel generated image: a 136 KB JPEG became 62 KB at quality 80, 36 KB at 50 and 20 KB at 20; a 76 KB WebP became 21 KB at 80; a 464 KB PNG stayed at 464 KB whatever the slider said. Your results depend on the picture, so judge by the preview rather than by percentages.

Where your image is processed

The file is read with the browser's FileReader and drawn to a canvas on your device. It is never uploaded, so there is no server queue and no size limit other than your device's memory. Very large photos can make the tab slow, because the canvas holds every pixel uncompressed while it works. The download link is a data URL built in the page, which is why it appears the moment the preview does.

Every browser can write PNG from a canvas. MDN's image file type guide covers JPEG and WebP support, and toDataURL falls back to PNG when a browser cannot encode the requested type, so a very old browser could hand you a PNG with a .webp name. In our test a current Chromium browser encoded all three formats as expected.

Choosing a quality setting

Start at the default of 80 and move down while watching the compressed preview at full size; stop when you first notice halos around edges or banding in skies and shadows. Photographs hide compression better than screenshots, where JPEG artefacts around text show quickly; screenshots and flat graphics are better kept as PNG, or saved as WebP where supported. Re-saving an already compressed JPEG at a higher quality than its original cannot bring detail back and may make the file bigger.

Related tools on this site work the same way, in your browser: the Favicon Generator turns an image into 16 by 16 and 32 by 32 icons, the Image Color Picker reads exact colour values from an image, and the Zip / Unzip Tool bundles a set of compressed images for sending.

Frequently Asked Questions

What image formats are supported?

JPEG, PNG and WebP, detected from the file type. The compressed file keeps the same format as the original. The quality slider changes JPEG and WebP output; PNG is lossless, so for PNG the slider does nothing and the size may not drop.

Will compressing my image ruin the quality?

Lossy compression always discards some detail; how much you notice depends on the picture and the quality you pick. Compare the two previews at full size before downloading, and keep the original file, because the lost detail cannot be recovered from the compressed copy.

Is there a file size limit?

No limit is imposed by this site, because nothing is uploaded. The practical limit is your device: a very large image needs a lot of memory on the canvas and can make the browser slow or unresponsive.