Media Tools

Client-Side Image Compressor

Compress JPG, PNG and WebP images entirely in your browser. Files are processed locally on your device — nothing is ever uploaded.

1. Choose an image

2. Compression settings

Please choose an image first.

3. Result

Once you choose an image the compressed result appears here in real time.

All compression runs locally in your browser: your images never leave your device, nothing is uploaded and no network request is made.

How the Client-Side Image Compressor works

How it works

The compressor decodes the selected file into an in-memory HTMLImageElement, then lets you choose an output format (lossy JPG, lossy WebP, or lossless PNG), a quality value from 0.1 to 1, and a target width. The height is recomputed automatically to preserve the original aspect ratio. The image is then drawn onto a 2D canvas with drawImage. For JPEG output the tool paints a solid white background first, because the JPEG format cannot store an alpha channel; WebP and PNG keep transparency. Finally, canvas.toBlob encodes the result with the chosen format and quality.

The target width is capped at the source image's natural width, so the tool never upscales — enlarging would only interpolate pixels without adding detail. The quality slider drives the encoder for lossy formats; for PNG it is intentionally ignored because PNG compresses without discarding data. Every step runs inside the browser, so the file is processed locally and no image data is uploaded.

Use cases

People use this tool to shrink photos before emailing them, uploading them to a website, or posting them to social platforms; to reduce screenshots before attaching them to tickets and documentation; and to fit images under strict file-size limits without installing desktop software.

Troubleshooting

If a transparent PNG becomes opaque, check the format — JPG output always fills transparency with white because it cannot hold an alpha channel; switch to PNG or WebP to keep transparency. If the quality slider seems to do nothing, you are likely encoding to PNG, which is lossless by design. Very large images can be slow or fail, because browsers cap canvas dimensions and decoding a huge file consumes a lot of memory; reduce the target width or start from a smaller source. If the page reports that Canvas is unavailable, the current environment lacks 2D canvas support and compression cannot run there. If the output looks rotated or its dimensions appear swapped, the source photo is carrying an EXIF orientation tag — phone cameras store rotation there instead of rotating pixels. Modern browsers honor that tag when decoding, but a pipeline or viewer that skips it can produce a sideways result, so normalize the orientation in the source file before compressing.

FAQ

Are my images uploaded or sent anywhere?
No. Compression runs entirely on your device through the Canvas API, and no file data ever leaves your browser.
Does the quality slider affect PNG output?
No. PNG is a lossless format, so the quality setting is ignored. The slider only changes the size and fidelity of lossy JPG and WebP output.
What happens to transparent PNGs when I choose JPG?
JPEG cannot store an alpha channel, so transparent areas are filled with a solid white background before encoding.
Why is a very large image slow to compress?
Huge images consume significant memory when decoded and drawn to a canvas, and browsers impose maximum canvas dimensions. Resize to a smaller target width or use a lower-resolution source.
Can I upscale my image?
No. The target width is capped at the original width to avoid enlarging the image, which would only add pixels without improving quality.