Image Compression 101: How to Shrink File Size Without Ruining Quality
A slow-loading website, a photo that won't attach to an email, a design file that blows past an upload limit — image compression is the fix for all of these, but "just compress it" hides a surprising amount of nuance. Push it too far and you get visible artifacts; not far enough and you've barely solved the problem. Here's what's actually happening when an image gets compressed, and how to pick settings that make sense for what you're doing.
Lossy vs Lossless: The Fundamental Trade-off
Every image compression method falls into one of two categories:
- Lossless compression shrinks a file without discarding any visual information. Decompress it, and you get back pixel-for-pixel exactly what you started with. PNG uses lossless compression — it finds patterns and redundancy in the pixel data and encodes them more efficiently, similar in spirit to how a ZIP file compresses text.
- Lossy compression shrinks a file by selectively discarding information the format's designers judged to be less perceptually important — subtle color gradients, high-frequency detail — in exchange for a much smaller file. JPEG and WEBP (in its lossy mode) work this way.
The trade-off is direct: lossless formats guarantee perfect quality but hit a size floor determined by how much genuine redundancy exists in the image. Lossy formats can shrink far past that floor, but every additional reduction in file size comes at the cost of some real image quality — and that trade-off is irreversible once applied.
Why PNG and JPEG Behave So Differently
This is where a lot of confusion starts, because the "right" format depends heavily on what's in the image:
- Photographs — full of smooth gradients, subtle color variation, and natural noise — compress well under JPEG's lossy method, because the human eye is relatively forgiving of small color shifts in that kind of content. A JPEG photo can often be 5-10x smaller than the same image saved as PNG, with quality loss that's hard to spot at normal viewing sizes.
- Screenshots, logos, and line art — large flat color regions and sharp edges — actually compress worse under JPEG than you'd expect, because JPEG's lossy algorithm introduces blocky artifacts and color bleeding around hard edges (this is the "halo" you sometimes see around text in a heavily-compressed JPEG screenshot). PNG's lossless approach handles flat colors and sharp edges far more efficiently, often producing a smaller file than JPEG for this kind of content, not just a cleaner one.
The rule of thumb: photos favor JPEG, graphics favor PNG. Using the wrong format for the content type can leave you with a file that's simultaneously larger and lower quality than the alternative.
Where WEBP Fits In
WEBP is a newer format that supports both lossy and lossless modes, generally achieving smaller file sizes than JPEG or PNG at equivalent visual quality — often 25-35% smaller than a comparable JPEG. Its main limitation historically was compatibility (very old software and services didn't support it), but that's largely resolved now across modern browsers, operating systems, and design tools. For web use specifically, WEBP is usually the best default when you don't have a compatibility constraint forcing you toward JPEG or PNG.
Understanding the Quality Slider
Most compression tools expose a quality setting (often 0-100) that controls how aggressively a lossy format discards information. A few practical guidelines:
- 90-100: Visually near-identical to the original, with a meaningful size reduction over an uncompressed file. Good for anything where quality matters and you have some size headroom.
- 70-85: The practical sweet spot for most web and email use — a substantial size reduction with quality loss that's very difficult to notice at normal viewing distance/zoom.
- Below 60: Size gains taper off while visible artifacts (blockiness, color banding, blurring around edges) become increasingly noticeable, especially in images with fine detail or text.
There's rarely a good reason to go below roughly 60-70% quality for anything meant to be looked at closely — the size savings below that threshold shrink while the visual damage grows.
Resolution Matters as Much as Quality Setting
A frequently overlooked lever: image dimensions. A photo captured at 4000×3000 pixels but displayed at 800×600 on a webpage is carrying roughly 12x more pixel data than it needs to. Resizing to the actual display dimensions before compressing often achieves a bigger size reduction, with zero visible quality loss, than cranking up compression on an oversized image. Compression and resizing solve different problems — compression reduces redundancy within existing pixels, resizing reduces the number of pixels in the first place — and combining both usually beats leaning on either alone.
A Practical Workflow
- Match the format to the content — JPEG or WEBP for photos, PNG for screenshots/graphics/anything with transparency.
- Resize to the dimensions you'll actually display, rather than shipping a camera-resolution image at thumbnail size.
- Compress at 75-85% quality as a starting point for lossy formats, adjusting down only if size still isn't where you need it.
- Compare before and after at full zoom, not just thumbnail size — artifacts that are invisible small can be obvious once zoomed in or printed.
Tools for the Job
- Image Compressor — shrink file size with an adjustable quality setting, entirely in your browser.
- Image Resizer — resize to exact dimensions before compressing.
- Bulk Image Resizer — apply the same resize to many images at once.
Image compression isn't a single "make it smaller" button so much as a set of trade-offs between format, resolution, and quality — but once you know which lever to pull for which kind of image, getting a small, clean file stops being guesswork.