Skip to content
PictureToLink
Menu
Image Compression

Lossy vs Lossless Compression: What's the Difference?

Lossy vs lossless image compression explained with real examples: how much smaller files get, what you lose, and which to use for photos or graphics.

By PictureToLink Team · · 8 min read
Facts checked against official sources on

On this page

Lossless compression makes an image file smaller without changing a single pixel: decompress it and you get back exactly what you started with. Lossy compression makes files much smaller by permanently discarding detail that people are unlikely to notice. Use lossy compression (JPEG, or lossy WebP or AVIF) for photos, and lossless compression (PNG, or lossless WebP) for screenshots, logos and anything with sharp edges or text.

How image compression saves space

An uncompressed image stores a colour value for every pixel. A 12-megapixel photo has 12 million pixels, each needing three bytes for red, green and blue, so it would take roughly 36 MB stored raw. Nobody shares photos that way, because compression removes the waste.

There are two kinds of waste in an image:

  • Repetition. A blue sky, a white document background or a flat-coloured logo contains long runs of identical or predictable pixels. Describing "the next 400 pixels are white" takes far less space than listing 400 white pixels. Removing this kind of waste loses nothing.
  • Detail the eye ignores. Human vision is much more sensitive to brightness than to fine colour changes, and it struggles to see tiny variations in busy textures such as grass, hair or water. Throwing that detail away makes files far smaller, but the detail is gone for good.

Lossless compression only removes the first kind. Lossy compression removes both.

Lossless: same pixels, smaller file

Lossless compression works like a ZIP file for pictures. The encoder finds patterns and stores them more efficiently, and the decoder rebuilds the original exactly. You can open, edit and re-save a losslessly compressed image as many times as you like without it getting worse.

Common lossless methods:

  • PNG filters each row of pixels to make it more predictable, then compresses the result with DEFLATE (RFC 1951), which is also one of the standard compression methods in ZIP files. The PNG specification describes that filtering step as "deterministic, reversible, and lossless".
  • GIF uses LZW compression on images limited to a palette of up to 256 colours. The compression is lossless, but converting a full-colour photo into 256 colours is not, which is why photos saved as GIF look grainy or banded.
  • Lossless WebP and lossless AVIF are newer options that support full colour and transparency. Google reports that lossless WebP images are 26% smaller than PNGs.

The catch is size. Lossless files of photographs stay large, because a photo's natural noise and texture have few exact repeats to exploit. Lossless compression shines on graphics with flat colour, where repeats are everywhere.

A note on "lossless" savings

How much a lossless re-save saves depends on how carefully the original was saved. A PNG written quickly by a screenshot tool or an app with light compression settings can often be squeezed a lot further with the same pixels. One that was already optimised will barely change.

Lossy: smaller file, invisible losses

Lossy compression goes further. A JPEG encoder, for example, splits the image into 8 × 8 pixel blocks, converts each block into a description of its patterns, then rounds off the fine detail according to a quality setting. Lower quality means more rounding, a smaller file and, eventually, visible problems.

At sensible settings, the losses are hard to see at normal viewing size. Push too far and you get the classic signs:

  • Blocky squares in smooth areas such as skies.
  • Halos or "mosquito noise" around sharp edges and text.
  • Smudged fine textures and colour bleeding.

Our guide to JPEG artifacts shows what each looks like and how to avoid them.

Two habits keep lossy compression safe:

  1. Compress once, from the best original. Every lossy save throws away a little more. Editing and re-saving a JPEG repeatedly slowly degrades it, so keep the original and export a compressed copy at the end.
  2. Resize before you compress. Reducing a 4000-pixel photo to the size it will actually be shown at removes far more data than any quality setting, without the artifacts. Our guide on how to reduce image file size explains the order of steps.

Side-by-side test results

To show the difference with real numbers, we ran our test images through our own upload pipeline (sharp/libvips, the same processing every PictureToLink upload goes through). These are measurements on our sample files, not guarantees for every image.

A screenshot (PNG, 1366 × 900, 2.3 MB)

MethodTypeResultSaved
Re-saved as PNG with maximum compressionLossless712 KB69.3%
PNG reduced to a colour paletteLossy (fewer colours)525 KB77.4%
Converted to WebP at quality 80Lossy126 KB94.6%

The lossless re-save cut the file by more than two thirds with identical pixels, a sign that the original had plenty of room. Going lossy was dramatically smaller again. For a screenshot that people will just glance at, the WebP is the sensible choice. For a screenshot of fine text that must stay crisp, the lossless PNG is the safer one. Lossless WebP is another option: our 1440 × 900 screenshot of plain text went from 137,357 bytes to 29,614 bytes as WebP (78.4% smaller), and our pipeline kept it lossless.

A photo (JPG, 3000 × 2000, 961 KB)

MethodTypeResultSaved
Re-encoded as JPEG at quality 90Lossy883 KB8.1%
Re-encoded as JPEG at quality 80Lossy843 KB12.3%
Re-encoded as JPEG at quality 68Lossy596 KB38.0%
Converted to WebP at quality 80Lossy607 KB36.9%

This photo was already a JPEG, so the easy savings had been taken. Each step down in quality bought a smaller file. The jump from quality 80 to 68 saved far more than the step from 90 to 80, which is typical: the last few quality points cost a lot of bytes.

What the results show

  • On graphics, lossless compression alone can make a big difference, and lossy formats go much further.
  • On photos that are already JPEGs, re-compressing at similar quality saves little. Real savings come from lower quality settings, a newer format or, above all, resizing.
  • Results vary from image to image. In the same tests, converting a different 3024 × 2016 photo to WebP at quality 80 saved only 13.9%, while a 4032 × 2623 landscape photo shrank by 48.1%. Always check the result.

To try this on your own files without uploading them, the image compressor runs in your browser and shows the before and after sizes. Choose PNG for lossless output, or JPG or WebP with a quality slider for lossy output.

Which formats use which

FormatLosslessLossyTransparencyAnimation
JPEGNoYesNoNo
PNGYesNo (palette reduction is a lossy pre-step)YesYes (APNG)
GIFYes, but limited to 256 coloursNoOn/off onlyYes
WebPYesYesYesYes
AVIFYesYesYesYes

The MDN image format guide is a reliable reference for the details, including that GIF is limited to a palette of up to 256 colours and that WebP and AVIF support both lossy and lossless encoding as a setting you choose. Animated PNG (APNG) became part of the official PNG specification with the W3C's third edition, published in June 2025. Our guide to image file formats compares them all side by side.

Choosing for photos, screenshots and logos

Photos. Use lossy compression. JPEG at a quality around 75 to 85 is a safe default that works everywhere, and WebP or AVIF can be smaller where they are supported. Resize to the display size first.

Screenshots. It depends on the content. For screenshots of text, code or interfaces where crispness matters, use PNG (lossless). For screenshots of photos, video frames or games, lossy WebP or JPEG is fine and much smaller.

Logos, icons and line art. Use lossless compression: PNG, or lossless WebP. Lossy compression smears the sharp edges and flat colours that make a logo look clean. If you have a vector version (SVG), that is often better still on a website.

Images with transparency. Use PNG, WebP or AVIF. JPEG has no transparency, so transparent areas turn into a solid background when you convert.

Archive copies and originals you will edit later. Keep them lossless or keep the camera original, and only export lossy copies for sharing.

Common questions

Is a PNG always lossless?

The PNG format itself is lossless, but a PNG can still have lost information before it was saved. Tools that shrink PNGs by reducing them to a palette of fewer colours (our "Smallest file" setting does this) are making a lossy change first and then saving it losslessly. A PNG made from a JPEG also keeps every JPEG artifact.

Can I turn a lossy image back into a lossless one?

No. Saving a JPEG as PNG preserves what is left, artifacts included, in a bigger file. The discarded detail cannot be recovered, which is why it pays to keep your originals.

Does uploading to a website compress my image again?

Often, yes. Many platforms re-encode uploads with their own lossy settings. PictureToLink does too, with a choice of "High quality", "Balanced" or "Smallest file". If you want minimal change, choose "High quality" and upload your best original rather than a copy that has already been compressed.

Next step

Take one photo and one screenshot from your device and run both through the image compressor: try PNG for the screenshot and JPG or WebP for the photo, and compare the sizes and the look. For a full step-by-step routine, continue with how to reduce image file size without losing quality.