Skip to content
hostcomplex

Lossy vs Lossless

Maarten Soetens 2 min read

How Lossy and Lossless Compression Differ

Lossy vs lossless compression describes two ways of reducing an image's file size. Lossless compression makes the file smaller without discarding any pixel data, so the decoded image is identical to the original. Lossy compression discards detail the viewer is less likely to notice, which produces much smaller files at the cost of some fidelity.

Lossless methods look for patterns and store them more efficiently. A flat area of one colour, or a repeated pattern, shrinks well. A photograph contains fine variation in almost every area, so lossless compression reduces it much less. Learn more about the image optimization decisions that surround this choice.

Lossy methods work differently. They split the image into brightness and colour detail, then store the fine colour detail more coarsely. The eye is less sensitive to small colour differences than to brightness changes, so many discarded details are invisible at normal viewing sizes.

Quality Settings and Visible Artifacts

Most lossy formats offer a quality setting, where a higher value keeps more detail and produces a larger file. Lowering the setting saves bytes until visible damage appears. Typical damage includes blocky patches in smooth skies, colour bleeding around sharp edges and banding in gradients.

Each time a lossy file is saved again, it loses a little more detail. This build-up is called generation loss. For this reason, keep a lossless master copy and create lossy versions from that master, rather than re-saving an already compressed file.

Which Method Suits Which Image

Photographs of people, places and products usually suit lossy compression. Small quality losses are hard to see, and the savings are large. A moderate setting often gives a good balance, which should be checked by eye on the actual image.

Graphics with flat colours, text and sharp edges, such as logos, charts and screenshots, show lossy artifacts quickly. Lossless formats keep them crisp, and vector formats such as SVG scale without any loss of quality. Images that need transparency also need care, because JPEG does not support transparency. A logo with a transparent background usually needs PNG, lossless WebP or a vector file. For the newer formats, see the WebP vs AVIF comparison.

Frequently asked questions

Is Lossy Compression Bad for Images?

Not when used well. Lossy compression is the reason most photos on the web load quickly. The loss is a deliberate trade-off. Problems appear only when settings are too aggressive or when the same image is repeatedly re-saved. Viewing the result at the size it will be shown is the best test.

Is Lossless Compression Always the Better Choice?

No. Lossless files are often much larger for photographs, which slows pages without a visible benefit. Lossless is the better choice for logos, screenshots and graphics with sharp edges, and for images that will be edited again later.

  • Two-Factor Authentication

    Two factor authentication hosting adds a second check to control panel, domain and CMS logins. Learn which methods are strongest and why 2FA helps.

  • What Is an A Record?

    What is an A record? Learn how this DNS record maps a hostname to an IPv4 address, why domains use several A records and the root and www pattern.

  • Billing and Automation Platforms

    What is WHMCS? Learn how this commercial billing and automation platform helps hosts sell plans, collect payments and create accounts automatically.