How to Compress Images Without Wrecking Quality
The Real Problem With Most Image Compression Advice
Most tutorials tell you to "just compress your images" and point you at a tool. What they skip is the part that actually matters: understanding why compression degrades images and how to stay just inside the safe zone. Once you get that, the tool almost doesn't matter. You could use Photoshop, Squoosh, or a command-line utility and consistently land on files that are 60–80% smaller with no visible difference on screen.
This walkthrough is for anyone managing images for a website, an email newsletter, or a product listing — situations where file size is a real constraint but so is looking professional.
Lossy vs Lossless: Pick the Right Battle
Before you touch a quality slider, you need to know which type of compression you're even dealing with. The two work on completely different principles.
Lossless compression reorganizes the data in your image file more efficiently — like packing a suitcase better without leaving any clothes behind. The image that comes out is bit-for-bit identical to what went in. PNG uses lossless compression, and so does the lossless mode in WebP. You'll typically shave 10–30% off file size this way, sometimes more for simple graphics.
Lossy compression permanently removes image data. JPEG is the classic example. It exploits the fact that the human eye is less sensitive to fine color detail than to brightness, so it smears together colors in small regions while keeping edges sharp. Done well, you can't see the difference. Done badly, you get those familiar blocky artifacts around high-contrast edges — the ghost of compression past.
Here's the practical rule: use lossless for logos, icons, screenshots, and anything with text on a solid background. Use lossy for photographs and complex real-world scenes where the detail is so rich that small losses disappear into the noise.
Understanding Quality Sliders (They're Not All the Same)
Every image editor and compression tool has a quality slider, and almost none of them agree on what the numbers mean. A quality setting of 80 in Photoshop's "Save for Web" is not the same as 80 in GIMP, Lightroom, or ImageMagick. They use different internal algorithms and scales.
What stays consistent across all of them is the principle: lower number equals more data thrown away equals smaller file and worse quality. The sweet spot for web photography in JPEG is almost universally between quality 60 and 80 regardless of tool, but you need to calibrate for your specific software with your own eyes.
Here's how to find your tool's actual sweet spot:
- Take a single representative photo — something with a mix of textures, skin tones or fabric, and a sharper element like text or a product edge.
- Export it at quality 90, 80, 70, 60, and 50.
- Open all five versions side by side at 100% zoom, not scaled down in a browser.
- Note the lowest quality where you genuinely cannot see a difference at 100% zoom.
- That's your floor. In practice, go one step above it for safety.
For most photography shot with a decent camera or phone, you'll land around 70–75. For stock photos already edited to high contrast, you might find 65 works fine.
WebP: The Format Conversation You Need to Have
JPEG was designed in 1992. It's remarkable that it still works so well, but there's a better option available today that most people still underuse: WebP.
WebP delivers roughly 25–35% smaller files than JPEG at equivalent visual quality. It supports both lossy and lossless modes. It handles transparency (unlike JPEG). Browser support is now effectively universal — every browser released after 2020 handles it, and you can check caniuse.com to confirm your audience's coverage.
The workflow shift is small. Use Squoosh (squoosh.app, free, runs in-browser), convert images with the cwebp command-line tool, or let your CMS handle conversion automatically if it supports it. WordPress has had WebP support baked in since version 5.8.
AVIF is the next step beyond WebP — even better compression — but encoding is slow and support, while growing, still has gaps. For most projects in 2024, WebP is the practical sweet spot between compatibility and efficiency.
The Dimension Problem Nobody Talks About
Compression gets all the attention, but image dimensions are often the bigger culprit. A photo that comes off a modern smartphone is typically 12 megapixels — roughly 4000 × 3000 pixels. If you're displaying it in a blog post column that's 800 pixels wide, the browser downloads all 4000 pixels of width and then scales it down. You're paying for data you never use.
Resize first, then compress. Figure out the maximum display width of your image container, multiply by 2 for retina/HiDPI screens, and resize your image to that width before compressing. For a standard blog post with an 800px content column, resize to 1600px wide. Then compress. You'll often find that step alone cuts the file to a third of its original size even before compression enters the picture.
Email Is a Different Beast
Web images and email images have different constraints, and the settings that work for one can get you into trouble with the other.
Email clients don't cache images. Every open re-downloads them. More importantly, many corporate email environments are slow, and Gmail clips emails over 102KB of total HTML. Images themselves load from your server, but a slow image can make the whole email feel broken on a mobile connection.
For email, the targets are stricter:
- Header/hero images: aim for under 150KB, ideally under 100KB.
- Product thumbnails: under 40KB each.
- Total image payload for one email: under 500KB is a reasonable ceiling.
That means more aggressive compression than you'd use on the web. Quality 60–65 in JPEG is normal for email hero images. You're viewing them on a phone for three seconds — the slight softness is invisible in context. Test by looking at the image on your phone at normal email-reading distance (about 30cm). If it looks fine, it is fine.
Also: email clients famously block images by default in many enterprise settings. Don't embed all your information in images. Use alt text, and make sure the email reads sensibly in plain text.
Tools Worth Actually Using
The choice of tool matters less than the settings, but here's an honest assessment of what's practical:
- Squoosh (squoosh.app): The best browser-based option, full stop. Side-by-side comparison with a draggable divider. Supports WebP, AVIF, MozJPEG, and PNG. Free. No upload limit. Use this for manual, one-off compression where quality judgment matters.
- ImageOptim (Mac only): Drag-and-drop desktop app. Brilliant for lossless PNG compression and bulk processing. Also handles JPEG. Runs locally so nothing leaves your machine.
- Sharp (Node.js library): If you're running a web project and want to automate compression in a build pipeline, Sharp is the go-to. Extremely fast, high quality, supports everything including WebP and AVIF output.
- Cloudflare Images / Cloudinary: If you need to serve images at scale, these CDN-based services compress and resize on-the-fly via URL parameters. Pricier, but eliminates the manual step entirely once configured.
Checking Your Work: The Three Tests
Before you call it done, run three quick checks:
- 100% zoom test: Open the compressed image in any image viewer at full pixel size. Look at the sharpest edges — text, product corners, hair. If you see blocking or color halos, you went too far.
- File size sanity check: For a typical web photo, under 200KB is good, under 100KB is great. If you're still over 300KB after compression, check dimensions first — you probably forgot to resize.
- Real device test: Load the compressed image on a mid-range Android phone (not your fancy iPhone) on a WiFi connection and then on 4G. This tells you what the median user actually experiences. If it loads fast and looks clean, you're done.
The Mindset Shift That Changes Everything
The mistake most people make is trying to find one setting that works for everything. There isn't one. A photograph of a sunset compresses very differently from a product photo on a white background, which compresses very differently from a screenshot of software UI.
Build the habit of checking your compressed files before publishing rather than trusting a setting you picked once six months ago. It takes thirty seconds and it's the difference between images that look sharp and professional and images that subtly make your site look cheap — which visitors notice even when they can't articulate why.
Good compression is invisible. That's the whole point. Nobody should look at your web page or open your email and think about the images at all. They should just see your content, fast, looking exactly like you intended.