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.
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.
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 fact | Detail |
|---|---|
| Reversible | Yes, decodes byte for byte |
| How PNG does it | Per-row filtering, then DEFLATE |
| Best on | Flat colour, text, line art, screenshots |
| Weak on | Photographs and fine natural texture |
| Formats | PNG, 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.
Assuming that converting a JPEG to PNG restores quality, when it only preserves the artefacts already baked in.
Confusing palette reduction (lossy) with PNG's compression (lossless) because both happen when you export a PNG.
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.
Same cluster
More from the glossary
Neighbouring entries, so every term in the set is one hop from every other.
Listing image
A listing image is a photo attached to a product listing on a marketplace.
Mask
A mask is a non-destructive control that decides which parts of a layer are visible without deleting any pixels.
Lifestyle shot
A lifestyle shot shows a product in real use and real surroundings rather than isolated on a plain background.
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.
Keep reading
Elsewhere on Photomop
Platform image rules
Image size, file type and background rules for 22 selling platforms, each one sourced.
Read itConvert image
JPG, PNG, WebP and AVIF, with an honest answer about HEIC and alpha.
Read itAll the tools
The whole toolbox in three families, with what each one needs before it can run.
Read itOn-device privacy
The pipeline in five steps, what leaves your device, and how to check it yourself.
Read it
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.