Image Compressor
Reduce image file size while maintaining quality
Drag & drop an image here
or click to browse
Supports JPEG, PNG, WebP
Compression Settings
Before & After
Original
Compressed
The Image Compressor shrinks JPEG, PNG, and WebP files by re-encoding them at a lower quality or a smaller size, all inside your browser. Upload a file, adjust the quality slider, watch the before-and-after sizes update, and download the result. It is built for web developers optimizing page weight, marketers preparing social images, and anyone who needs a photo under a size limit without installing editor software.
How to Use
- Add an image. Drag and drop a JPEG, PNG, or WebP file onto the upload area, or click to browse. The file is read locally — nothing is uploaded.
- Set the quality. Move the slider between file size and fidelity. The estimated new size updates immediately, so you can stop at the point that meets your target.
- Compare side by side. Toggle the split view and zoom in to check edges, text, and gradients where artifacts show first.
- Choose an output format if needed, then download. The panel shows how many bytes and what percentage you saved.
Worked Examples
Example 1 — a hero image for a landing page. A 2400×1600 camera JPEG weighs 3.4 MB. Resizing to 1200 pixels wide and compressing at 80% brings it to roughly 220 KB with no visible difference at the size it is displayed. That single change can be the difference between a two-second and a half-second page load on mobile.
Example 2 — a screenshot for documentation. Screenshots of text look best as PNG, but a full-screen capture can exceed 1 MB. Compressing the PNG reduces color depth while keeping text sharp; if the screenshot is mostly flat UI, converting to lossless WebP often saves more while retaining perfect edges.
Example 3 — a photo for a form with a 1 MB limit. Upload the photo, set quality to 70%, and check the estimated size. If it is still over the limit, reduce the pixel dimensions by 20% at a time until the output fits — losing a little resolution usually looks better than heavy compression artifacts.
How the Compression Works
The browser reads the file into memory, draws it onto an HTML canvas, and asks the canvas to re-encode the pixels in the chosen format at the chosen quality. For JPEG and WebP, the encoder uses lossy compression: it groups pixels into blocks, transforms them, and discards detail the eye is least likely to notice. The quality value controls how aggressively that detail is dropped. PNG has no quality dial, so the tool reduces the palette and strips ancillary chunks instead.
Because re-encoding happens from decoded pixels, most EXIF metadata — GPS, camera model, timestamps — is dropped along the way. Some viewers preserve orientation by reading the EXIF rotation flag; if a photo appears sideways after compression, rotate it before encoding.
Choosing a Format and Quality
- JPEG — photographs and rich gradients; universally supported. Excellent size-to-quality ratio, no transparency.
- WebP — the best modern default: roughly 25–35% smaller than JPEG at equivalent quality, with transparency support in both lossy and lossless modes. Supported by all current browsers.
- PNG — screenshots, diagrams, logos, and anything needing sharp edges or transparency. Large for photos.
A practical workflow: identify the content type, pick the format that matches it, resize to the real display size, then tune quality until artifacts appear and back off one step. For most photos that lands between 75% and 85%.
Common Mistakes and Edge Cases
- Compressing instead of resizing. A huge image shown small is the most common cause of bloated pages. Fix the dimensions first.
- Stacking compressions. Re-compressing an already-lossy file adds artifacts each round. Always start from the original.
- Over-compressing text. Thin fonts and small labels degrade quickly below about 60% quality; use PNG or lossless WebP for text-heavy images.
- Expecting PNG to shrink like JPEG. Lossless compression cannot match lossy for photos; convert the format when the content allows it.
- Assuming the file got smaller. A poorly matched format or a very high quality setting can increase size. Check the reported numbers.
- Forgetting transparency needs. JPEG cannot store an alpha channel; a transparent logo saved as JPEG gets a solid background. Use PNG or WebP.
Features
- Drag-and-drop upload with local, private processing
- Adjustable quality slider with live size estimate
- Side-by-side, zoomable comparison of original and result
- JPEG, PNG, and WebP output with one-step conversion
- Before/after file sizes and savings percentage
- 100% client-side — images never leave your device
Use Cases
- Web performance: Cut page weight for product photos, banners, and blog images.
- Social media: Meet per-platform upload limits without visible quality loss.
- Email attachments: Keep files small enough to send reliably.
- Storage cleanup: Shrink photo libraries before uploading to cloud storage.
- Asset preparation: Convert and right-size images before adding them to a project.
Related Tools
Frequently Asked Questions
What quality setting should I start with?
Start at 80% for photographs. At that level the difference is usually invisible at normal viewing size while the file shrinks dramatically — often 50–80% on a camera photo. Drop to 60–70% only if you still need a smaller file and can accept slight softening. Below about 50%, blocky artifacts appear around edges and text.
Does compressing a PNG work the same way as a JPEG?
No. JPEG and WebP lose data by discarding fine detail, so a quality slider applies directly. PNG is lossless, so the tool reduces its color depth and strips metadata instead. For a photographic PNG, converting to JPEG or WebP will shrink it far more than trying to compress the PNG itself.
Will metadata like GPS location be removed?
Re-encoding through the canvas drops most EXIF data, including GPS coordinates, camera model, and capture time, because the canvas holds only pixels. That is often what you want before posting a photo publicly. If you need to keep the metadata, edit a copy of the original instead of the compressed version.
Should I resize rather than just compress?
If the image is displayed smaller than its pixel dimensions, resizing is the bigger win: a 4000-pixel-wide photo shown at 800 pixels wastes 80% of its bytes. Resize to the actual display size first, then compress — the two together usually cut file size by an order of magnitude.
Is my image uploaded anywhere?
No. The file is read locally with the FileReader API and re-encoded on a canvas inside your browser. Nothing is transmitted, so the tool is safe for confidential screenshots, client assets, and personal photos alike.
Why did my file get bigger after 'compressing'?
That happens when you re-encode a format that is already efficient, such as converting a small optimized JPEG to PNG, or when a high quality setting adds more data than the original carried. Check the before/after sizes the tool shows; if the output grew, raise compression or keep the original.
Reviewed by the HandyTools Hub team · Last updated