Skip to content
2xKit

How Image Compression Actually Works: Lossy vs Lossless Explained

What actually happens to your pixels during compression, and why lossy compression can cut file size by 90% with barely visible quality loss.

Quick answer

Lossless compression (like PNG) repackages the exact same pixel data more efficiently with zero quality loss, typically cutting size by 20-50%. Lossy compression (like JPG) permanently discards visual information the human eye is least sensitive to, usually in smooth color gradients and fine texture, which is why it can cut file size by 70-90% while still looking nearly identical at normal viewing sizes.

Every image compressor is making a trade between file size and information, and understanding what's actually being discarded (or not) explains why some compressed images look flawless at a tenth of the size while others develop visible blotches or blur. There are exactly two families of compression, and they work on completely different principles.

Lossless compression: same pixels, smarter packaging

Lossless compression, the kind PNG uses, finds patterns and redundancy in the pixel data and encodes them more efficiently, similar to how a ZIP file shrinks a text document without changing a single letter. A solid-color background compresses extremely well this way because there's enormous redundancy to exploit; a noisy photograph compresses poorly because there's little repeating pattern to find. Decompressing a lossless file reconstructs the exact original pixel values, byte for byte.

Lossy compression: throwing away what you won't notice

Lossy compression, the kind JPG and lossy WebP use, is built around a model of human vision: we're much more sensitive to changes in brightness than to changes in color, and much more sensitive to sharp edges than to subtle gradients. The algorithm groups pixels into blocks, transforms them mathematically, and discards the visual information we're least likely to consciously notice, then reconstructs an approximation on decompression. Pushed too far, this shows up as blocky artifacts around edges or banding in smooth gradients like skies, the tell-tale signs of over-compression.

The practical upshot is that there's a sweet spot: most photos can lose 70-80% of their file size with compression settings tuned correctly before quality loss becomes visible to the naked eye. Compress Image lets you preview that trade-off directly, and if you need to hit an exact file size ceiling for an upload form, Compress Image to Size automates finding the right quality level instead of trial-and-error.

Why re-compressing a JPG repeatedly degrades it

Because lossy compression discards data permanently, every time you open a JPG, edit it, and re-save it as JPG, another round of information gets thrown away on top of what's already gone, an effect called generation loss. This is why professionals keep a lossless master copy (PNG, or a raw camera file) and only export to JPG once, at the end of editing, rather than repeatedly saving over the same JPG through multiple edit sessions.

Frequently asked questions