← All guides

Lossless vs Lossy Compression Explained

compressionlosslesslossyexplainer

Compression makes files smaller. Two fundamentally different strategies exist: lossless keeps every bit of data; lossy throws away data deemed less important. Each has its place. Picking wrong loses quality you can’t recover.

The two strategies

Lossless compression finds redundancy in data and stores it more efficiently — like writing “the the the the” once with a multiplier instead of four times. Decompressing recovers the exact original bytes.

Lossy compression identifies data that won’t be missed and discards it — for images, frequencies the eye can’t perceive; for audio, sounds the ear can’t easily distinguish. The result is smaller but mathematically different from the source.

Examples of each

Lossless formats:

  • ZIP, GZIP, 7z — file archives
  • PNG, GIF — images
  • FLAC, WAV — audio
  • TIFF (uncompressed mode)
  • HTML, CSS, JSON, XML — text data

Lossy formats:

  • JPEG, WebP lossy mode, HEIC — images
  • MP3, AAC, OGG, Opus — audio
  • H.264, H.265 (HEVC), VP9, AV1 — video

Why lossy compression isn’t a problem (usually)

Lossy compression is designed around what people can’t perceive. The compression algorithm specifically targets:

  • In images: high-frequency detail the eye doesn’t see (subtle texture in smooth areas)
  • In audio: frequencies masked by louder sounds
  • In video: redundant information between frames

At reasonable quality settings (JPG quality 85, MP3 192 kbps), the loss is invisible/inaudible to most listeners.

The catch: each round of lossy compression compounds. Two saves of a JPG at quality 85 don’t equal one save at quality 85 — quality degrades each time.

When lossless matters

Master copies for editing: edit a lossless original; export to lossy for delivery.

Text and code: each character matters. Lossy compression isn’t applicable.

Compressed archives: ZIP a folder; unzip to get exact files back.

Source code, configuration files, data files: lossless is required.

Master recordings: musicians, podcasters keep WAV/FLAC originals.

RAW photos: from cameras; preserve the original sensor data.

Specifically for archival: lossless captures everything for future use.

When lossy is fine

Final delivery for consumption: JPG photos for sharing, MP3 music for listening, MP4 videos for watching.

Bandwidth-constrained delivery: streaming, mobile networks, email attachments.

Storage-constrained archives: when capturing “good enough” content is more important than preserving every detail.

Compression ratios — what to expect

Lossless ratios (typical):

  • Plain text: 50-70% reduction with ZIP
  • Code: 60-80% reduction
  • Already-binary content (compiled programs): 5-30%
  • Already-compressed content: 0-5%

Lossy ratios (typical, image example):

  • Original RAW: 30 MB
  • JPEG quality 95: 8 MB (~75% reduction)
  • JPEG quality 85: 3 MB (~90% reduction)
  • JPEG quality 65: 1 MB (~97% reduction)

Lossy wins dramatically for media. Lossless wins dramatically for text/code.

Quality control in lossy compression

Lossy compression offers a quality knob:

  • JPG: 0-100 quality slider
  • MP3: bitrate (32-320 kbps)
  • WebP/AVIF/HEIC: similar quality slider
  • Video: bitrate or CRF (Constant Rate Factor)

The slider trades quality against size. Most lossy formats have a “sweet spot” where quality looks/sounds essentially the same as the source while files are dramatically smaller.

Image sweet spot: JPG quality 85, WebP/HEIC quality 80 Audio sweet spot: MP3 192 kbps, AAC 160 kbps Video sweet spot: H.264 CRF 22

Below the sweet spot, quality degrades noticeably. Above it, quality is preserved but files are larger than necessary.

The “convert to lossless to fix” myth

A common misconception: “My JPG is bad quality, let me convert it to PNG to get better quality.”

This doesn’t work. The JPG already lost data through its compression. Converting to PNG just preserves the current (already-degraded) state losslessly. The PNG is bigger but has the same actual visual quality as the JPG.

To get better quality, you need a higher-quality source — not a different format.

The “keep re-saving JPG” mistake

Each JPG save compresses again. Repeated saves degrade quality cumulatively:

  • Save 1 at quality 85: minor invisible artifacts
  • Save 2: more artifacts
  • Save 3: visible degradation
  • Save 5-10: clearly damaged

To avoid this:

  • Edit in PNG (lossless) and save once to JPG at the end
  • Or work from a master and re-export to JPG when changes are made
  • Don’t save → close → reopen → resave repeated cycles

Lossless audio for archival, lossy for delivery

A common professional workflow:

  1. Record/capture in lossless (WAV at 24-bit/48 kHz)
  2. Edit and master in lossless (lossless throughout the pipeline)
  3. Export to lossy formats (MP3, AAC) for distribution
  4. Keep lossless masters for re-encoding if formats change

This way: the masters are perfect; the distribution copies are space-efficient.

Specific format trade-offs

Images

  • Photo → lossy (JPG/WebP/HEIC) for size
  • Logo/icon/screenshot → lossless (PNG/SVG) to preserve sharp edges
  • Archival → lossless (TIFF or PNG)

Audio

  • Music for listening → lossy (MP3/AAC) at 192+ kbps
  • Recording for editing → lossless (WAV/FLAC)
  • Voice content → lossy at lower bitrate is fine

Video

  • Distribution → lossy with H.264/H.265
  • Editing → less compressed (ProRes, DNxHR) for editing flexibility
  • Final masters → lossless or very high quality

Documents

  • Source documents → lossless format (.docx, .odt) for editing
  • Final distribution → PDF (preserves layout; minimal further compression)

Comparison table

FormatLossy/LosslessWhen to use
JPGLossyPhotos for sharing
PNGLosslessGraphics, screenshots, logos
WebP lossyLossyPhotos for web (better than JPG)
WebP losslessLosslessSame as PNG, more efficient
HEICLossyiPhone photo storage
MP3LossyMusic for listening
FLAC/WAVLosslessMaster audio recordings
AAC/M4ALossyApple ecosystem audio
H.264 MP4LossyStandard video distribution
ProResLossless (sort of)Professional video editing

TL;DR

  • Lossless preserves every bit; recoverable exactly. Used for text, code, master files.
  • Lossy discards “imperceptible” data; can’t recover original. Used for photos, audio, video for distribution.
  • For final delivery: lossy is usually right (much smaller files)
  • For working copies: lossless preserves quality across edits
  • Repeated lossy re-saves compound damage — don’t do this
  • Converting to a lossless format doesn’t restore quality — the original loss is permanent