photomopOpen the studio

Compression

Lossless compression

Also called lossless or lossless image compression. Here is what it means, when it changes what you export, and what people get wrong.

CompressionRuns on your deviceUpdated 10 August 2026

The short answer

Lossless compression makes a file smaller without changing a single pixel. Decompressing returns the original image byte for byte, so you can save, edit and resave forever with no degradation. PNG is the common example, and WebP, AVIF and TIFF all offer lossless modes alongside their lossy ones.

Updated

The short version

Lossless compression at a glance

Quick facts about Lossless compression: reversible, how png does it, best on, weak on, formats
Quick factDetail
ReversibleYes, decodes byte for byte
How PNG does itPer-row filtering, then DEFLATE
Best onFlat colour, text, line art, screenshots
Weak onPhotographs and fine natural texture
FormatsPNG, WebP lossless, lossless AVIF, TIFF

Slide the table sideways to see every column.

How does PNG compress without losing anything?

PNG works in two stages. First it filters each row of pixels: instead of storing the raw byte, it stores the difference between that byte and a prediction made from the pixel to the left, the pixel above, or a combination of neighbours. On smooth or repetitive areas those differences are mostly zero or very small numbers, which is exactly what a general-purpose compressor likes.

The filtered data then goes through DEFLATE, which finds repeated byte sequences and replaces them with back references, then Huffman-codes the result. Nothing is rounded or approximated at any point, so the decoder can rebuild the original array of pixels precisely.

This explains the format's split personality. A logo with six flat colours, a screenshot, or a chart on a white background gives DEFLATE enormous runs of identical bytes and compresses dramatically. A photograph of foliage gives it almost nothing repeatable, and the file can end up several times larger than a good lossy export of the same picture.

Which formats can store images losslessly?

  • PNG: lossless only, with full alpha transparency.
  • WebP: has both a lossy and a dedicated lossless mode, and supports alpha in either.
  • AVIF: supports lossless coding as well as its usual lossy mode.
  • TIFF: commonly stored uncompressed or with lossless LZW or Deflate compression, which is why it is a staple archival and print format.
  • GIF: lossless with respect to the pixels it stores, but limited to 256 colours per frame, so reducing a photograph to a GIF palette loses colour before compression even starts.

When is lossless the right call?

Choose lossless for anything you will edit again, anything with hard edges, and anything where exact colour matters. That covers master files, logos and brand assets, screenshots, diagrams, product cut-outs with transparent backgrounds, and images destined for print where a proof needs to match.

You can still make lossless files meaningfully smaller without touching image quality: strip embedded thumbnails and unnecessary metadata, drop an alpha channel that is fully opaque, and run a stronger PNG optimiser. Reducing an image to an indexed palette also shrinks PNG a great deal, but that step itself is lossy, since colours are being discarded before the lossless coder ever sees them.

What people get wrong about lossless compression

Each one is a real failure mode, not a style preference.

  1. Saving photographs as PNG for the web, which produces a file many times larger than a high quality JPEG or WebP for no visible benefit.

  2. Assuming that converting a JPEG to PNG restores quality, when it only preserves the artefacts already baked in.

  3. Confusing palette reduction (lossy) with PNG's compression (lossless) because both happen when you export a PNG.

  4. Keeping lossless TIFF masters but never checking that the compression is actually lossless, since TIFF can also wrap JPEG-compressed data.

Questions people ask

Lossless compression, answered

The follow-up questions people search for once they have the definition.

Does PNG lose quality when you save it again?

No. PNG compression is lossless, so resaving reproduces the same pixels every time. Quality only changes if the editing itself changes pixels, for example resizing, or if you export to an indexed palette with fewer colours than the original.

Is lossless compression always the safer choice?

Safer for the pixels, but not always the better choice. On photographs a lossless file can be several times larger while looking identical to a good lossy export at normal viewing size, which costs page speed and can breach upload limits.

Which is smaller, PNG or lossless WebP?

Lossless WebP is usually smaller than PNG on the same image, sometimes substantially. The gap varies with content, so if size matters, export both and compare rather than assuming. PNG remains the safer bet for maximum compatibility with older software.

Can you compress a JPEG losslessly?

You can apply lossless optimisation to an existing JPEG, such as rebuilding its entropy coding or converting between baseline and progressive, which shrinks the file without re-quantising. That does not undo the loss already present, it only avoids adding more.

From the studio

Tools that do this

Each one runs on your own device, so the photo stays where it is.

Sources

Where the facts on this page come from. Every link opens the specification, standard or documentation the claim was read at.

Now do it to a photo

Photomop is a photo studio that runs on your own device. Resize, crop, compress, convert, batch edit, remove a background and change one all work in the browser tab you are reading this in, at full resolution and with no watermark. The on-device page shows you how to check that the photo stays put.