Deep Dive Sep 10, 2026 · 8 min read

Lossy vs Lossless Compression Explained: How to Retain Quality at Small Sizes

Written and reviewed by the Compress To KB editorial team. Last updated September 24, 2026. We build and maintain the compressor this guide refers to, so what we say about how it behaves comes from its actual code and from day-to-day use, not from guesswork.

Every image compressor, ours included, ultimately makes one big decision: what information to keep and what to throw away. Get that decision right and a 4MB photo becomes a 150KB one that most people cannot tell apart from the original. Get it wrong and you end up with a blotchy face, a screenshot with fuzzy text, or a "compressed" file that is somehow larger than what you started with. This guide explains the difference between lossy and lossless compression in plain terms, shows where each one shines, and gives you a simple rule for choosing.

Lossless: Every Pixel Comes Back Exactly

Lossless compression finds patterns and stores them more efficiently, but when you open the file the pixels are identical to the original. Think of it like packing a suitcase more cleverly: you fold things better, but nothing is left behind. PNG is the most familiar example. It predicts each pixel from its neighbours, stores the small differences, and then squeezes the result with a general-purpose algorithm. Because it discards nothing, PNG is ideal for logos, icons, screenshots, diagrams and anything with sharp text or flat blocks of colour. WebP and AVIF also offer lossless modes.

The limit of lossless is that it can only shrink an image as far as its patterns allow. A photograph is full of tiny natural variations such as film grain, skin texture and leaves, so there are few exact patterns to exploit. It is common for a detailed photo saved as PNG to be several times larger than the same photo saved as a well-tuned JPEG.

Lossy: Discard What Eyes Barely Notice

Lossy compression accepts that the decoded image will not match the original exactly, and uses that freedom to make files dramatically smaller. It does so by exploiting how human vision works. JPEG, WebP (in lossy mode) and AVIF all follow the same broad recipe:

  • Colour is stored at lower resolution than brightness. Our eyes resolve brightness detail much more finely than colour detail, so encoders often keep the full-resolution brightness and store colour at half resolution in each direction, a technique called chroma subsampling.
  • The image is transformed into frequencies. JPEG splits the picture into 8×8 blocks and describes each one as a mix of smooth and detailed patterns. Newer formats use larger and more flexible blocks.
  • Fine detail is rounded off (quantisation). This is the step that actually throws information away. A lower quality setting means coarser rounding, so more detail disappears.
  • The remaining numbers are packed losslessly. The final entropy-coding stage squeezes the leftovers without further loss.

The quality slider you see in editors controls the rounding step. Small reductions in quality save a lot of space at first, then each further reduction costs more visible damage for smaller savings. That curve is why the best compression is often "one notch above where it starts to look bad".

What Lossy Damage Looks Like

Knowing the symptoms helps you spot when a setting is too aggressive. Blocking shows up as visible squares in smooth areas like sky, and it is the classic low-quality JPEG look. Ringing is a halo or speckle around sharp edges, especially black text on a white background, which is why compressed screenshots look "dirty". Banding replaces smooth gradients with visible steps. Colour bleeding smears saturated colours across edges, thanks to that reduced colour resolution. If you have ever wondered why a signature scanned at low quality is surrounded by faint grey dots, it is ringing at work, which is a good reason to read our practical guide on getting signatures under 20KB before you push a number too far.

Generation Loss: The Reason to Keep Your Original

Every time you open a lossy file, edit it and save it again as lossy, you apply another round of rounding on top of the last one. Errors accumulate. You can see it for yourself: take a photo, save it as JPEG at moderate quality, reopen it and save again, repeat ten times, and compare the first and the last. The last will look noticeably tired. The practical rule is simple. Keep an untouched original, always compress from that original, and compress only once at the end of your workflow.

How Compress To KB Chooses

Since you set a target size, the tool has to find a way to hit it, and the route depends on the format:

  • Lossy formats (JPEG, WebP, AVIF): the tool searches for the highest quality setting whose real encoded size still fits your target. It measures the actual file at each step rather than estimating. Only if even the lowest useful quality is not enough does it start reducing pixel dimensions.
  • PNG: because PNG has no quality slider, the only way to make it smaller is to reduce the pixel count. The tool searches for the largest scale that fits, and if that is still too large, it falls back to a lossy format instead of leaving you empty-handed.
  • Images with transparency: Auto mode prefers WebP, which can carry an alpha channel while remaining efficient, and PNG otherwise, so cut-out graphics keep their see-through areas.

You can override any of this with the Output Format dropdown. If a website or portal demands a particular format, choose it yourself rather than trusting Auto. We compare the formats in more depth in JPEG vs WebP vs AVIF.

A Simple Rule for Choosing

Your image is…Best approachWhy
A photograph of a person, product or placeLossy (JPEG, WebP or AVIF)Natural gradients hide rounding well; file sizes are far smaller
A screenshot with text or UILossless (PNG), or lossy at high qualitySharp edges show ringing quickly
A logo, icon or flat illustrationLossless, or SVG where possibleFew colours and hard edges suit exact storage
A cut-out with transparencyWebP or PNGThese formats carry an alpha channel
A photo that must fit a tiny limitLossy at the highest quality that fitsLossless simply cannot reach small sizes

Matching Targets to Content

The size you aim for should reflect how forgiving the content is. A close-up portrait of a face can look clean at 50KB, so the 50KB tool is a fair choice for it. A busy landscape with grass and foliage needs roughly two to three times that much for the same apparent quality, and the 150KB or 300KB pages are better matches. A detailed product or portfolio shot that people will zoom into deserves the 500KB tool. If your content has text baked into the image, add more headroom than you think you need.

Three Habits That Improve Any Result

  1. Resize before you compress when you know the display size. A 4000px image shown at 800px carries a great deal of unused data.
  2. Judge at the real viewing size. Zoomed to 400% on your monitor, every image looks bad. Look at it as a visitor would.
  3. Do not save a photograph as PNG "to keep quality". You will get a huge file and, in most cases, no visible advantage over a good lossy version.

The Takeaway

Lossless preserves everything and pays for it in file size; lossy trades invisible detail for big savings and pays for it if you push too far. Pick lossless for graphics with hard edges and lossy for photographs, keep your original, and let the target size decide how much rounding you can afford. When in doubt, compress once at the highest quality that meets the limit, then look at the result.

Sources & further reading

More Guides