Back to all posts
Foundations9 min readBy MegaConvert Editorial

Lossless vs lossy compression: what the words actually mean and why it matters

Lossless compression preserves every bit of the original; lossy compression throws bits away to save space. A foundational guide to the difference, the formats in each camp, and the practical rules of thumb for when to use which.

Almost every file format you regularly use makes a choice between two compression philosophies: lossless (every bit of the original is preserved exactly) or lossy (some data is permanently discarded to make the file smaller). The choice has consequences. Understanding the difference is the foundation for picking the right format for any given task — whether you're saving a photograph, recording audio, encoding a video, or backing up your hard drive.

This article explains what each kind of compression actually does, what file formats use which, and when each one is the right tool for the job.

Lossless compression: nothing thrown away

Lossless compression makes a file smaller without changing its contents. The file you decompress is bit-for-bit identical to the file you compressed — every pixel, every audio sample, every byte of text is exactly as it was. The compression works by finding patterns in the data and encoding them more efficiently.

The classic example is text compression. The string 'aaaaaaaaaa' (ten 'a' characters, 10 bytes) can be encoded as 'a×10' (4 characters, 4 bytes) — the original string can be perfectly reconstructed from the compressed version. Real lossless compressors (DEFLATE, LZMA, Brotli, zstd) use much more sophisticated pattern-finding, but the core idea is the same: redundancy in the input becomes savings in the output.

Lossless formats by category

  • Images: PNG, GIF (within its colour limit), TIFF (when LZW or ZIP-compressed), BMP (uncompressed counts), WebP (in lossless mode), AVIF (in lossless mode).
  • Audio: FLAC, ALAC (Apple Lossless), WAV (uncompressed counts), AIFF, APE, WV (WavPack).
  • Video: Rare in practice — uncompressed video is too large for most uses. ProRes (Apple's editing codec) is visually lossless. FFV1 is mathematically lossless.
  • Archives: ZIP, RAR, 7Z, TAR.GZ, TAR.BZ2, TAR.XZ — all lossless. Compression ratios vary, but no data is ever discarded.
  • Documents: PDF, DOCX, ODT, RTF — all lossless internally. The format itself doesn't lose information.

The important property: you can compress and decompress a lossless file as many times as you want. Each round-trip produces an exact copy of the original. There's no quality loss accumulated over generations.

Lossy compression: tactical data loss

Lossy compression makes a file dramatically smaller by throwing away data the encoder believes you won't notice. The reconstructed file is similar to the original but not identical. The trade-off is that lossy formats compress 10-100× better than lossless formats for the same content, at a cost of some quality.

The genius of lossy compression is that it exploits human perception. JPEG works by transforming image data into the frequency domain (using a discrete cosine transform) and discarding high-frequency components that the eye is poor at noticing. MP3 works by analysing audio against a model of human hearing and discarding sounds that would be masked by louder nearby sounds. Both formats produce output that's significantly smaller than the source while remaining perceptually 'close enough' for most purposes.

Lossy formats by category

  • Images: JPEG, JPEG XL (in lossy mode), WebP (in lossy mode), AVIF (in lossy mode), HEIC.
  • Audio: MP3, AAC, OGG Vorbis, Opus, WMA. All commonly-streamed music formats are lossy.
  • Video: H.264, H.265, VP9, AV1 — every video codec used for streaming or storage is lossy. Truly lossless video is impractical at consumer file sizes.
  • Archives, documents, data: None. These formats are always lossless because changing data values would corrupt the content's meaning.

The 'transcoding' trap

Lossy compression compounds when you re-encode. Convert MP3 to MP3 (at any settings) and you've gone through two lossy encode passes — each one throws away a little more data. Do it five times and the audio is noticeably degraded compared to the original.

The same applies to JPEG. Save a JPEG, edit it, save again, edit again, save again — each save compounds compression artifacts. Compare the result to the original photograph and you'll see visible noise around edges, blocky shadows, and muted colours.

The fix is simple: keep an editable lossless master, and only encode to lossy at the moment of distribution. Edit your photo in PSD or TIFF, save the final JPEG once. Mix your podcast in WAV, encode to MP3 once for distribution. This 'archive in lossless, distribute in lossy' workflow is the universal best practice for any media production pipeline.

When lossless is the right choice

  • You're producing a master copy that may be re-edited or re-encoded later. Generation loss compounds; lossless masters don't.
  • The data is text, code, structured records, or anything where bit-exact reconstruction matters. Documents, spreadsheets, source code, databases.
  • The image has sharp edges, text overlays, or large flat areas of colour. Lossless (PNG, lossless WebP) preserves these cleanly; lossy (JPEG) introduces visible artifacts at edges.
  • The audio is being mastered, edited, or analysed. Audio editing in MP3 is a recipe for cascading quality loss.
  • The file will be archived for the long term and will need to be readable in 30 years. Lossless formats degrade gracefully; lossy ones can become unrecoverable if even small bits flip in storage.

When lossy is the right choice

  • You're distributing the file to end users who will only consume it (not re-edit it). Streaming music, web images, social media uploads.
  • File size matters more than perfect fidelity. Mobile bandwidth, slow networks, large libraries, storage costs.
  • The content is photographic or musical — the kinds of content lossy compression was designed for. Lossy compression of photographs is nearly invisible at high quality settings.
  • You can keep a lossless master separately. Lossy is fine for the distribution copy; just don't lose the master.

A practical decision framework

Ask yourself: will this file be edited again, or is this the final form? If it'll be edited, keep it lossless. If it's the final output that an end user will only view or listen to, lossy is fine.

And: does the content type match the format type? Photographs match lossy formats; logos and screenshots match lossless. Music and voice match lossy formats; audio for editing or analysis matches lossless. Documents and code match lossless always.

Make those two decisions consciously and you'll avoid 95% of the format-choice mistakes that plague even experienced creators. Browse all our format guides for deeper dives on specific format families.

Continue reading

More guides on file formats and conversion.