Image Compressor
Shrink any JPG, PNG, or WebP image by quality or to an exact KB target — all in your browser, nothing uploaded.
PNG files are welcome as input. PNG is a lossless format, so to hit an exact KB target the tool exports your image as JPG or WebP — choose either as the output format below.
Compression runs in your browser with the Canvas API — your image is never uploaded. Re-encoding also strips EXIF/location metadata.
Understanding the Image Compressor
The Image Compressor reduces the file size of a JPG, PNG, or WebP image entirely in your browser — nothing is ever uploaded. Choose a quality level with a simple slider, or switch to target mode and name an exact size in kilobytes; the tool then finds the highest quality that still fits under your limit. You can keep the original format or convert to JPG or WebP, and optionally cap the width to shrink large photos further. A side-by-side preview shows the original and compressed versions with both file sizes and the percentage saved, so you can confirm the result looks right before downloading.
How it works
Your image is drawn onto an HTML canvas and re-encoded with the format and quality you pick. In Quality mode, the slider value (0.1–1.0) is passed straight to the encoder. In Target file size mode, the tool binary-searches the quality between 0.1 and your chosen base value: it encodes, checks the byte count, and narrows the range over several passes until the output lands at or just under your KB target. An optional max-width setting downscales the canvas first, which cuts size dramatically. JPG output is flattened onto a white background since it has no transparency. PNG is lossless, so target mode is disabled for it. Everything runs locally with the Canvas API.
Worked example
You upload a 4.2 MB, 4000×3000 JPG from your phone for a web page that wants images under 200 KB. You switch to Target file size mode, enter 200, and leave the output as JPG. The tool binary-searches the quality and lands at about 190 KB — a 95% reduction — with no visible loss at normal screen sizes. Setting max width to 1600 px first would drop it even lower, near 90 KB, while staying crisp on most displays.
Tips & common mistakes
- Use Target file size mode when a platform or upload form enforces a hard KB limit — it removes the guesswork of nudging a slider.
- For photos, quality 60–80% usually looks identical to the original at a fraction of the size; reserve 90%+ for images with fine text or gradients.
- Set a max width (e.g. 1600 px) for web use — downscaling a huge photo saves far more than quality tweaks alone.
- WebP typically beats JPG by 15–30% at equivalent quality, depending on image complexity. Test both formats with your target KB size to see which looks better for your use case.
- Target file size needs a lossy format, so for PNGs choose JPG or WebP output to hit a size goal; keep PNG only when you need lossless or transparency.
- Re-encoding strips EXIF and GPS metadata, which is a privacy bonus before sharing photos online.
Related tools
Frequently Asked Questions
Can I compress an image to a specific KB size?
Yes. Switch to "Target file size" mode and enter a KB value — the tool binary-searches the JPG or WebP quality to land at or under that size. Target mode needs a lossy format, so PNGs are exported as JPG or WebP.
Which formats are supported?
You can upload JPG, PNG, or WebP. Output can stay the same format or be converted to JPG or WebP. PNG is lossless, so for hard size targets choose JPG or WebP output.
Is my image uploaded to a server?
No. Compression happens entirely in your browser using the Canvas API. Your image never leaves your device, and re-encoding also strips EXIF/location metadata.