Design glossaryLossy compression makes a file much smaller by permanently removing detail people are unlikely to notice. JPEG, lossy WebP, and MP3 use it.
Lossy compression makes files dramatically smaller by discarding information that people are unlikely to see or hear, and it cannot be undone: once detail is thrown away, it is gone. Nearly every photo, song, and video on the web is stored this way, because the savings are huge and, at sensible settings, the loss is invisible.
The opposite approach, lossless compression, keeps every bit but cannot get files nearly as small.
How it works
Lossy codecs model human perception and spend fewer bits where our senses are least sensitive. JPEG is the classic example:
- The image is converted from RGB into brightness and color channels, because the eye is far more sensitive to brightness than to fine color detail.
- The color channels are often stored at lower resolution (chroma subsampling).
- The image is split into small blocks, and each block is transformed into a set of frequencies, from smooth gradients to fine detail.
- Those frequencies are rounded off (quantized). This is where data is actually lost, and the quality setting controls how aggressive it is.
- What remains is packed with lossless coding.
Audio formats such as MP3 and AAC work on a similar principle. They do not simply cut frequencies outside human hearing; they use a model of hearing to drop sounds that would be masked by louder ones at the same moment.
Common lossy formats
- Images: JPEG, lossy WebP, AVIF, and HEIC (common on iPhones).
- Audio: MP3, AAC, and Opus.
- Video: H.264, H.265 (HEVC), VP9, and AV1.
Artifacts to watch for
- Blocking: visible squares, most obvious in skies and skin.
- Ringing: halos or fuzz around sharp edges and text.
- Banding: smooth gradients breaking into steps.
- Color bleeding: red or blue edges smearing, from reduced color resolution.
Text, line art, and screenshots show these artifacts quickly, which is why they are better saved as PNG, lossless WebP, or SVG.
Using lossy compression well
- Keep a lossless or high-quality master. Each time a lossy file is edited and saved again, it loses more (generation loss). Export delivery copies from the original.
- Do not trust quality numbers across tools. "Quality 80" in one app is not the same as in another, and it is not a percentage of anything. Judge by eye at the size the image will be shown.
- Pick a modern format. WebP and AVIF usually reach the same visual quality as JPEG at a smaller file size.
- Resize first. Shrinking dimensions to what the page needs saves more than lowering quality.
WordPress applies lossy compression to the resized copies it makes of uploaded JPEGs, at a default quality of 82. Our image compression entry covers format choice and WordPress settings in more detail.