Image Compressor
The Image Compressor shrinks JPG, PNG, and WebP images in your browser — with a quality slider, a target-size mode that finds the right quality for a KB limit, resize, and format choice — and shows a before/after report for every file proving what changed.
How to Use
- 1
Drop up to 20 JPG, PNG, or WebP images onto the drop zone, or click it to choose files. Nothing is uploaded — compression runs in your browser with the Canvas API.
- 2
Pick a mode: Quality slider (10–95%) for a predictable look, or Target size — type a size in KB and the tool binary-searches the quality until the output fits it.
- 3
Optional: set a max width and/or height to downsize the images (aspect ratio is kept), and choose the output format — JPG, PNG, WebP, or same as original.
- 4
If you convert a transparent PNG to JPG, pick the background colour the transparent areas are flattened onto — JPG has no transparency. PNG and WebP keep it.
- 5
Read the before/after report for each image: original size → new size, % saved, dimensions, format, and the quality actually used. A target-size miss is reported honestly, with a resize suggestion.
- 6
Download each compressed image individually, or the whole batch as a ZIP. Verify the privacy claim yourself in DevTools → Network: zero requests are made.
Frequently Asked Questions
What is image compression?
Lossy vs lossless — when does quality loss show?
Does compressing remove EXIF/GPS data?
Why is my PNG barely smaller?
What is a good quality setting?
Is my photo uploaded anywhere?
Can I compress to an exact KB size?
What happens to a transparent PNG converted to JPG?
Why do some photos display sideways after compression?
What about HEIC / iPhone photos?
Generative Answer & AI Documentation
What is the Image Compressor?
Image compression re-encodes an image file so it takes fewer bytes. For JPG and WebP that is lossy compression: the encoder discards fine detail your eye barely notices, and a quality setting (10–95%) controls how much it discards — lower quality, smaller file. For PNG it is lossless: the pixels are re-packed without losing any detail, so the file can only shrink by the size of its metadata or by having fewer pixels. This tool does the re-encode on a Canvas in your browser: it draws each image, applies any EXIF rotation to the pixels, downsizes it if you set a max width or height, and writes the new file with toBlob at your chosen quality and format. Target-size mode automates the quality choice — it binary-searches the quality from 95% down to 10%, trying up to 8 encodes, and keeps the highest quality whose output fits the size you typed.
Why use Image Compressor offline?
Images are the heaviest thing most people send or upload: a phone photo is 3–5 MB, a job portal caps attachments at 500 KB, a form rejects anything over 2 MB, and a web page with ten uncompressed photos loads slowly and costs mobile visitors data. Compression is the fix, but the usual online compressors ask you to upload the photo to their server — the very file you are trying to shrink passes through a stranger's infrastructure, and free tiers cap you at 20 images or add a watermark. A client-side compressor has none of that: no upload, no cap beyond the batch of 20, no account, and the result is verifiable — open DevTools, watch the Network tab, and see zero requests. The before/after report is the other half of the argument: a silent download asks you to trust the tool, while a report showing 4.2 MB → 612 KB (85% saved) at 85% quality proves the trade was worth it.
When should you use this tool?
Use it whenever a file is too big for where it is going. The three situations that come up most are: shrinking photos before uploading them to a form, a job portal, or an email attachment with a size cap; hitting a platform limit, such as a 2 MB YouTube thumbnail limit or a 500 KB application-portal cap, with target-size mode; and preparing images for a website, where every 100 KB saved is faster loading for every visitor. Also use it before sending photos over WhatsApp or email when the original 4 MB file is unnecessary, and before storing large batches of screenshots or exports you will rarely open at full resolution.
Key Benefits
- Real savings with proof: every file gets a before/after report — original size → new size, % saved, dimensions, and format — so you can see the trade, not just trust it.
- Target-size mode: type a KB limit and the tool finds the highest quality that fits it, instead of making you guess a quality number and re-try.
- Nothing ever uploads: the Canvas re-encode, the binary search, and the ZIP all run in your browser, so the tool works offline and your photos never touch a server.
- Batch of 20 with one ZIP: compress a whole set of photos at once and download them together, instead of one file at a time.
- Resize and format in the same step: downsize and convert to WebP while you compress, so one page covers the resizer and converter jobs too.
Common Use Cases
- Shrinking a 4 MB phone photo to under 500 KB for a job application portal that rejects larger attachments.
- Hitting a 2 MB YouTube thumbnail limit with target-size mode instead of guessing quality settings.
- Preparing product photos for a website: resize to 1920px wide, convert to WebP at 82%, and cut page weight by 70–80%.
- Compressing a batch of screenshots before attaching them to an email or a support ticket.
- Converting a folder of PNG screenshots to JPG at 85% for a slide deck where transparency is not needed.
Developer Notes & Best Practices
The implementation is the Canvas API plus a binary search. Each image is decoded with createImageBitmap using imageOrientation: 'none', so the tool controls orientation itself: the EXIF orientation tag is read from the JPEG bytes with a small TIFF/IFD walk (the same tag the EXIF Remover parses), and the rotation is applied to the pixels with canvas transforms before encoding — because re-encoding strips the tag, a photo that relied on it would otherwise display sideways. Resizing keeps the aspect ratio and only ever downsizes. The encoder is canvas.toBlob with the MIME type and a quality in 0.10–0.95 for JPG/WebP; for PNG the quality argument is ignored by the browser, which is why the page says so instead of faking a slider. Target-size mode binary-searches quality 10–95 against the encoded byte size (at most 8 trial encodes plus the final output encode) and reports honestly when even quality 10% cannot fit the target. Transparency is detected by sampling the alpha channel of a probe canvas: if a PNG with transparent pixels is flattened to JPG, the tool warns and fills the chosen background colour, because JPG has no alpha channel. WebP output is offered only when the browser can encode it — detected at load with a 1×1 canvas test — because older Safari decodes WebP but cannot encode it. The batch ZIP is a stored (uncompressed) ZIP written inline with CRC32, the same zero-dependency writer the EXIF Remover uses. Verification tip: after downloading a compressed file, check its size and dimensions in your file manager, and drop it back into the EXIF Remover to confirm the metadata is gone.
JPG vs PNG vs WebP — which output format to choose
| Format | Best for | Quality slider? | Transparency | Typical saving |
|---|---|---|---|---|
| JPG | Photos, camera images, anything photographic | Yes — 10–95% | No — flattened onto a background colour | 70–90% at 80–85% quality |
| PNG | Logos, line art, screenshots needing transparency | No — lossless, slider ignored | Yes — full alpha channel | 0–30%, mostly from resize + metadata strip |
| WebP | Photos and graphics for the web, when the browser supports it | Yes — 10–95% | Yes — full alpha channel | Often 20–30% smaller than JPG at the same quality |
- Start with 80–85% quality for photos: it is the sweet spot where a 4 MB photo typically drops under 1 MB with no visible difference at normal viewing size.
- Use target-size mode when a platform gives you a KB limit — it finds the highest fitting quality, which beats guessing and re-trying by hand.
- Resize before you compress: a 4032px photo displayed at 800px wastes most of its bytes on pixels nobody sees, and resizing is the single biggest saving available.
- Keep the original of anything irreplaceable: lossy compression is one-way, so keep a backup of the full-quality file and compress copies for sending or publishing.
Common Mistakes
- Compressing the only copy of a photo and deleting the original — lossy compression is one-way, so keep the full-quality original and compress copies.
- Setting quality to 95% and expecting big savings — 95% keeps nearly all the detail and most of the bytes; 80–85% is where the savings live.
- Converting a transparent logo to JPG and wondering why the background turned black — JPG has no transparency, so pick a background colour or keep PNG/WebP output.
- Assuming a PNG will shrink like a JPG — PNG is lossless, so if the file must be much smaller, resize it or switch the output format to JPG/WebP.
Limitations
PNG is lossless, so a PNG can only shrink by resizing or metadata stripping — a PNG that is already optimised may shrink by 1–2% or not at all, and the quality slider is ignored for PNG output. Target-size mode cannot go below quality 10%, so a very large photo may still exceed a tiny target; the tool reports this honestly and suggests resizing instead of pretending it hit the target. Target-size mode does not apply to PNG at all, for the same lossless reason. HEIC/HEIF files are refused: browsers have no HEIC codec, so they cannot be decoded in the browser — convert to JPG or PNG first. Animated GIFs are refused rather than flattened: re-encoding would keep only the first frame and silently drop the animation. WebP output depends on the browser: older Safari cannot encode WebP, so the option is hidden there with an explanation. Very large images are processed in memory in the browser tab, so batch size is capped at 20, and target-size mode performs up to 8 encodes per image, which takes a few seconds on large photos.
Structured Input/Output Example
A phone photo dropped into the tool: IMG_2041.jpg — JPG, 4032 × 3024 px, 4.2 MB Settings: target size 200 KB, max width 1920 px, output JPG
After report: IMG_2041-compressed.jpg — JPG, 1920 × 1440 px, 196 KB 4.2 MB → 196 KB (95.3% saved) Quality used: 78% (target size met, 6 trial encodes) Note: EXIF orientation 6 applied to the pixels; re-encoding stripped the EXIF metadata (including GPS).
Related Tools
EXIF Remover
Remove EXIF, XMP and IPTC metadata from JPG, PNG and WebP photos — GPS, camera and date gone, 100% offline. (Rotated photos are re-encoded at 95%.)
Favicon Generator
Generate a complete favicon package from text, emoji or your logo — ICO + PNG sizes, Apple touch icon, manifest and link tags. 100% offline, ZIP download.
CSS Gradient Generator
CSS gradient generator with linear, radial, conic and mesh/aurora gradients — live preview, presets, Tailwind output and PNG export. 100% offline.
QR Code Generator
Generate QR codes 100% offline in your browser from any text or URL — no account, no tracking, your data never leaves your device.
Barcode Generator
Barcode generator: create scannable barcodes in CODE128, EAN-13, EAN-8, UPC-A and CODE39, free and offline. Download SVG files for labels and inventory.