How to Compress an Image Without Losing Quality You Can See
A practical guide to compressing images: lossy vs lossless, the quality slider tradeoff, why smaller files speed up your site, and how to do it all locally.
How to Compress an Image Without Losing Quality You Can See
A photo straight off a phone camera is usually three to eight megabytes. That is fine sitting in your camera roll. It is not fine as a blog hero, a product listing, or a Slack attachment, where every one of those megabytes turns into slower page loads, melting storage quotas, and inboxes that bounce the message back. Compressing the image fixes all of that, and the surprising part is how little you give up to do it.
This guide walks through what compression actually does to your pixels, where the safe sweet spot sits, and why a smaller file makes a measurable difference to anyone loading your page.
Lossy vs lossless: two very different jobs
There are two families of image compression, and confusing them is the most common mistake I see.
Lossless compression — what PNG and GIF use — packs the file smaller without throwing away a single pixel. Decompress it and you get the exact bytes back. That sounds ideal until you realize there is a hard floor: a photo with millions of subtly different colors simply cannot be squeezed much without losing information, so a lossless photo stays huge.
Lossy compression — JPEG, WebP, and AVIF — does the opposite. It deliberately discards detail, but it is clever about which detail. These encoders drop the high-frequency information your eye barely registers: tiny color shifts in a patch of sky, fine noise in a shadow, the exact gradient between two near-identical greens. You keep the structure that matters and lose the data that does not, and the file shrinks dramatically.
The rule that follows from this is simple. Photos want a lossy format. Screenshots of flat UI, logos, and diagrams with sharp edges and few colors usually want PNG, because JPEG smears text edges into a blurry mess. If you force PNG on a photo it stays enormous; if you force JPEG on a screenshot the text turns to mush.
The quality slider, and why 80 is the sweet spot
Every lossy encoder exposes one perceptual knob: quality, usually 0 to 100. It controls how aggressively detail gets thrown out.
Here is the mental model worth memorizing:
- Quality 95 is near visually lossless. It still trims roughly 25% off a fresh-from-camera JPEG, because cameras over-encode their output. You will not see a difference even pixel-peeping.
- Quality 80 is the web sweet spot. Google's own PageSpeed guidance recommends 75 to 85, and side by side with the original, almost nobody can tell which is which. This is where you should live by default.
- Quality 60 is aggressive. It is fine for thumbnails, social previews, and anywhere the image renders small — but at full size you start to notice softness and blocky artifacts in flat regions.
Quality 80 is the answer to "what number do I pick" about 90% of the time. The detail it removes is genuinely below the threshold your eye notices at normal viewing distance, and the size payoff is large.
A worked example
Let me make that concrete with a real file.
Say you have a hero photo exported straight from your camera roll: 4032 × 3024 pixels, JPEG at quality 92, weighing 6.1 MB. Drop it into a local compressor, switch the output to WebP, and set the quality slider to 80. The result comes back at around 380 KB — a 94% cut.
Open the original and the compressed version side by side and the honest truth is you cannot tell them apart at normal size. The sky is still smooth, the subject is still sharp, the text on any sign in the frame is still legible. What changed is everything that matters for delivery: that hero now loads in well under a second on a 4G connection instead of stalling the whole page.
A more conservative move — keeping JPEG and just dropping quality 92 to 80 — typically cuts a phone photo by 45 to 60% with no visible difference. Converting to WebP at the same quality usually saves another 20 to 30% on top. AVIF, where the browser can encode it, squeezes a further 20 to 30% beyond WebP. The savings stack.
Why smaller images actually speed up your site
It is easy to treat "smaller file" as an abstract win. It is not abstract.
Images are routinely the single heaviest thing on a web page — often more bytes than your HTML, CSS, and JavaScript combined. When a browser has to pull a 6 MB hero before it can paint the page properly, the visitor stares at a blank or half-built layout. On a phone over mobile data that wait can run several seconds, and a meaningful slice of people leave before it finishes.
Shrink that hero to 380 KB and the math changes completely. The image arrives in a fraction of the time, the layout settles faster, and your Largest Contentful Paint — the Core Web Vital that tracks when the main content shows up — drops accordingly. Search engines factor that speed into ranking, so compression is quietly an SEO move as much as a UX one. Multiply the saving across every image on a page and a heavy gallery that crawled before now loads briskly.
Doing it locally, and why that matters
Here is the part I care about most, and the reason I reach for our local image compressor instead of the usual upload-it-somewhere services.
Most of the images you compress are not neutral. They are product shots, UI mockups, ID documents, receipts, or personal photos. Handing those to an unknown server just to save a few kilobytes is a bad trade. A browser-based tool sidesteps it entirely: the file is read with FileReader, painted onto an off-screen <canvas>, and re-encoded through canvas.toBlob() — all inside your own tab. Open the DevTools Network panel while you compress and the request count stays at zero. Nothing leaves your machine.
When I prep images for a post, I batch a folder of screenshots through it, watch the size delta appear next to each thumbnail, and download the lot — and I never once wonder whose servers my drafts just passed through. Re-encoding also strips EXIF metadata as a side effect, including the GPS coordinates baked into phone photos, which is exactly what you want before posting anything publicly. If you need to hit an exact byte budget rather than a quality target, the image target size compressor works backward from the number you give it.
A few traps to avoid
- Don't compress the same JPEG twice. Each lossy pass throws away detail you cannot recover. Pick your quality once, and keep an untouched original somewhere if you might need a redo.
- Don't force PNG on photos. A photo saved as PNG stays huge because PNG is lossless. Use WebP or JPEG and let the tool show you the size difference.
- Remember EXIF gets stripped. That is usually a feature, but if you genuinely need the camera model or GPS for an archive, save an unprocessed copy first.
Compression is one of the highest-leverage things you can do for a site: a few seconds of dragging a slider, and your pages load faster for everyone who visits. Pick a lossy format for photos, park the quality at 80, and check the before-and-after numbers. Most of the time you will be deleting megabytes nobody will ever miss.
Made by Toolora · Updated 2026-06-13