Lossy image compression permanently deletes data your eye will not miss to make a file far smaller. Lossless compression instead repacks the exact same pixels into fewer bytes and hands back a perfect copy, with no data lost. That is the whole split. So what is lossy image compression in practice: it is how JPEG, WebP, and HEIC shrink photos, trading a little detail for a much smaller file, while PNG and GIF stay pixel exact.
I build the compressor behind this site, so this comparison runs on real files, not a textbook description. Pick the wrong family and you end up with either fuzzy text and blocky logos, or a photo five times bigger than it needs to be. This page is the side by side: what each family costs in bytes, which formats belong to which, and how to choose by content type. For the settings that protect quality once you have picked a family, see compressing images without losing quality.
What is lossy image compression?
Lossy image compression is a method that shrinks a file by throwing away detail permanently, using inexact approximations and partial data discarding to represent the picture in far fewer bytes (Wikipedia: Lossy compression). Understanding what is lossy image compression comes down to one idea: some of the original data is gone for good, and no later step brings it back.
The trade is deliberate. A camera sensor records more color and tonal detail than any screen can show, and the human eye is far more sensitive to brightness than to fine color shifts. Lossy encoders exploit that gap, dropping the information you are least likely to notice and keeping the rest. On a photograph the result can look identical to the original at normal size while weighing a fraction as much. That is why JPEG has run the web for thirty years, and why every phone photo you take is already lossy before you touch it.
How does lossy compression throw data away?
Lossy compression discards data in three stages: it transforms the image into frequency information, quantizes that information to coarser steps, then entropy codes the result. The decoded picture is close enough to the original that you rarely see the difference, but it is not identical (Wikipedia: Lossy compression).
Transform, quantize, entropy code
JPEG and most lossy formats chop the image into small blocks and run each through a discrete cosine transform, which restates the block as a sum of wave patterns from smooth to fine. Quantization then rounds those patterns to coarser values, and this is the step that actually loses data: the fine, high frequency patterns your eye barely registers get rounded hardest, often to zero. What survives is packed tight by entropy coding, a lossless final squeeze. Turn the quality slider down and you are telling the quantizer to round more aggressively, which is why a quality 40 JPEG shows blocky edges a quality 80 one does not.
Perceptual coding and chroma subsampling
On top of the transform, lossy encoders lean on how human vision works. Chroma subsampling stores full brightness detail but throws away half or three quarters of the color resolution, because you cannot see the loss. This perceptual coding is why lossy works so well on photos and so badly on flat graphics: a photograph hides the discarded detail in its noise and texture, while a screenshot with sharp text has no noise to hide it in, so the artifacts show.
What is lossless compression, and how is it different?
Lossless compression shrinks a file with zero data loss, so the original picture can be reconstructed perfectly, pixel for pixel, from the compressed file (Wikipedia: Lossless compression). It never touches image quality; it only removes redundancy, the repeated and predictable patterns a file can store more compactly. Decompress it and you get every original bit back.
The catch is that a photograph has little redundancy to remove. Sensor grain and continuous tone give a lossless encoder almost nothing to fold up, so lossless image compression on a photo saves only a little. On a flat graphic with big blocks of one color, redundancy is everywhere, and lossless shrinks it dramatically while keeping every edge crisp.
How perfect reconstruction works
The two lossless engines behind image formats are DEFLATE and LZW. DEFLATE, the algorithm inside ZIP, gzip, and PNG, combines LZ77 pattern matching with Huffman coding, mapping frequent byte runs to shorter codes (Wikipedia: Lossless compression). GIF uses LZW over a fixed palette of 256 colors. Both are fully reversible: nothing about the pixels is approximated, so a PNG opened and re-saved a hundred times is bit for bit the same file it started as.
Which image formats are lossy, and which are lossless?
JPEG is always lossy, PNG and GIF are always lossless, and WebP, AVIF, and TIFF can go either way depending on how the file was saved. The file extension alone does not tell you which mode a flexible format used, which is where most of the confusion starts.
| Format | Family | How it compresses |
|---|---|---|
| JPEG | Always lossy | Discrete cosine transform, chroma subsampling, entropy coding |
| PNG | Always lossless | DEFLATE, the same algorithm behind ZIP and gzip |
| GIF | Always lossless | LZW over a fixed 256 color palette |
| WebP | Either, set at save time | Lossy VP8 style prediction, or lossless substitution coding |
| AVIF | Either, set at save time | Lossy AV1 style transform, with a lossless mode too |
| TIFF | Usually lossless | Often uncompressed or DEFLATE; lossy modes exist but are rare |
WebP is the format people ask about most, because it does both. It supports lossy compression through predictive coding based on the VP8 video codec, and lossless compression that substitutes for repeating data (MDN: Choosing an image format). Lossy WebP runs about 25 to 35 percent smaller than a JPEG of similar quality, and lossless WebP about 26 percent smaller than the same picture as PNG (MDN: Choosing an image format).
Lossy vs lossless compression, side by side
Lossy buys you a much smaller file at the cost of some permanent detail; lossless keeps the file perfect at the cost of size. The right pick depends entirely on the content: photographs go lossy, sharp graphics and masters go lossless. Here is the whole trade in one view.
| Attribute | Lossy | Lossless |
|---|---|---|
| Data kept | Approximate, some discarded | Exact, all of it |
| File size | Much smaller | Larger |
| Reversible | No, loss is permanent | Yes, perfect reconstruction |
| Best content | Photographs, web images | Text, logos, screenshots, masters |
| Formats | JPEG, lossy WebP, HEIC, AVIF | PNG, GIF, lossless WebP, TIFF |
The reversibility row is the one competitors leave out, and it is the one that decides real work. Lossy is a one way door. Once the data is discarded, the smaller file is all you have, so you keep an untouched master if you will ever need to edit or re-export. Lossless is the format you archive in for exactly that reason.
How much smaller does lossy compression really get you?
Lossy compression gets you categorically smaller files than lossless ever will on a photo, not a little smaller. Still images are often compressed around 10 to 1 with lossy methods, while lossless tops out wherever the file's real redundancy runs out (Wikipedia: Lossy compression). To put real numbers on the gap, I ran a controlled test.
The test: two images, four files each
I built two test images, both 2000 by 1500 pixels, 3.0 megapixels, and saved each one four ways with standard encoders on 2026-07-16. One is photographic, with smooth tones, soft shapes, and fine grain, the way a camera frame looks. The other is a flat graphic, solid color blocks, thin lines, and text, the way a screenshot or a logo looks. Same pixels in, four files out.
On the photograph, lossy wins in a landslide. The lossless copies both land above five megabytes, while the lossy JPEG is 399 KB and the lossy WebP just 272 KB, a 13 to 1 cut with no visible change at normal size.
| Format | Photo file size | Family |
|---|---|---|
| PNG | 5,300 KB | Lossless |
| WebP lossless | 5,258 KB | Lossless |
| JPEG quality 80 | 399 KB | Lossy |
| WebP quality 80 | 272 KB | Lossy |
The flat graphic flips the result completely. Here lossless wins, and the lossy JPEG is actually the worst option, larger than the PNG and softened by artifacts around the text. WebP in its lossless mode crushes everything.
| Format | Graphic file size | Family |
|---|---|---|
| WebP lossless | 37 KB | Lossless |
| PNG | 214 KB | Lossless |
| WebP quality 80 | 104 KB | Lossy |
| JPEG quality 80 | 271 KB | Lossy |
That crossover is the whole lesson. On the photo, lossy is 13 times smaller. On the graphic, the lossless WebP is smaller than the lossy JPEG and keeps every edge sharp. Choosing by content type, not by habit, is worth more than any single setting. It also matches the wider benchmarks: lossy compression commonly reduces a photo by 50 to 90 percent of its original size, while forcing a photo into lossless PNG does the reverse (Cloudinary: How lossy compression works). The homepage demo on this site shows the same shape on a real photo: a 497 KB JPG comes back 214 KB as WebP at quality 80, 56.9 percent smaller, with no visible change.
When should you use lossy or lossless?
Use lossy for photographs, where your eye cannot see the discarded detail and the byte savings are large, and lossless for anything with sharp edges or exact meaning: screenshots, logos, line art, and any master file you might edit again. Lossy suits human facing media because the mind fills in minor gaps, while text and data files need every bit exact (Wikipedia: Lossy compression).
| Content type | Best family | Why |
|---|---|---|
| Phone and camera photos | Lossy | Noise hides the discarded detail; savings are large |
| Screenshots and UI captures | Lossless | Flat color and sharp text; lossy blurs the edges |
| Logos and icons | Lossless | Exact color and edges matter, transparency often needed |
| Line art and diagrams | Lossless | Flat regions compress cleanly with no loss |
| Archival or print masters | Lossless | Keep one exact copy to export fresh copies from |
| Web photo galleries | Lossy | Total size across many images beats one perfect original |
The practical rule: photographs lossy, graphics and masters lossless. If a file has both, like an infographic built over a photo, save it lossless so the text stays crisp, or split the layers. When you need to shrink a lossless graphic that is still too heavy, run it through a dedicated PNG compressor rather than converting it to JPEG and taking the artifacts.
Does saving a lossy file as a lossless format undo the damage?
No. Once lossy compression discards data, saving the result into a lossless format only locks in whatever is left; it restores nothing. A JPEG re-saved as PNG usually ends up bigger than the JPEG, not smaller, because DEFLATE finds little repeating pattern in photographic noise, the same reason lossless struggles to shrink photos at all.
Worse, repeatedly re-saving a lossy file compounds the loss. Each lossy save quantizes an already quantized image, so artifacts build with every generation, a problem called generation loss that lossless formats do not have (Wikipedia: Lossy compression). The fix is to keep an untouched original and always export fresh copies from that master, never from an already compressed file. Some JPEG edits, like cropping or rotating in 90 degree steps, can be done without re-encoding using a tool such as jpegtran, but any edit that changes pixel values needs a full re-encode and another lossy pass.