File Formats & Media

Lossy Compression

Definition

It is the approach behind almost all web media: JPEG, WebP, AVIF and HEIC for images, MP3, AAC and Opus for audio, H.264, VP9 and AV1 for video. The encoder models what human perception is least sensitive to — fine high-frequency detail in a picture, quiet sounds masked by louder ones nearby — and discards it, keeping the rest. A quality setting or a target bitrate controls how aggressive that discarding is. Ratios of ten to one are ordinary and fifty to one is possible on video, where lossless compression of the same photograph might manage two to one. The discarded data is gone: no decoder, no upscaler and no amount of later processing brings the original bytes back.

Why It Matters

Because the loss is permanent, it also accumulates. Re-encoding a file that is already lossy quantises material that is itself an approximation, so the errors compound — edit and re-save a JPEG five times at quality 80 and blocking appears along every edge. The working habit that avoids this is simple: keep a lossless master, whether that is a RAW file, a TIFF, a PNG export or a WAV, and generate fresh lossy copies from it each time rather than editing the published one. The other half of the job is picking the setting honestly. A photograph at JPEG quality 85 might be 210 KB against 430 KB at quality 95, for a difference almost nobody sees at normal viewing distance — so the higher setting doubles the download and buys nothing.

How It Works

For images, the encoder transforms blocks of pixels into the frequency domain with a discrete cosine transform or something similar, divides the resulting coefficients by a quantisation table scaled by the quality setting, and rounds them to integers. That rounding is the lossy step; everything after it, the entropy coding, is lossless. Audio codecs split the signal into bands and allocate bits according to a psychoacoustic model, spending nothing on frequencies that are masked. Video adds motion prediction so most frames store only the difference from a neighbour, which is why video compresses so much harder than a sequence of stills. Each family leaves its own signature when pushed too far: blocking and ringing in JPEG, banding in gradients, smeared detail and a metallic edge to over-compressed speech.

Real-World Example

A gallery scans an exhibition poster at high resolution, producing a 42 MB TIFF. Published unchanged it would be unusable on the web; exported at 2000 pixels wide and quality 82 it is a 380 KB JPEG, comfortably under any file size limit and indistinguishable on a screen from the scan. The page goes up on 99helpers at exhibit-poster.99helpers.site, and the TIFF stays in the archive for the day someone asks for a print.

Common Mistakes

  • Treating the published file as the master — every fresh crop or caption means another lossy generation on top of the last
  • Choosing a quality number by reputation rather than by looking — the useful range is narrow and varies by image, so compare at full size before committing
  • Applying a lossy format to screenshots, diagrams or text — the artefacts cluster exactly where the sharp edges are
  • Converting between lossy formats to save space — a JPEG turned into WebP inherits the JPEG artefacts and then adds new ones

Related Terms

Put a file online in seconds

Drop in a document, an image, a page or a whole static website and share the link — free, with no build step and no server to set up.

Host a file free →