fileformer
search⌘KtranslateENexpand_moreupload_fileConvert
Converters8 file families · 44 direct conversions
What changes in a conversionarrow_forward
concepts / lossy compression

What is Lossy Compression?

Smaller, because some of it is gone.

Lossy compression throws away detail it predicts you won't notice, then stores what's left very compactly. Drag the quality down and watch where your browser's JPEG encoder cuts first: fine lines, small print and red on blue.

JPEG QUALITY40%
Split viewShow the difference
JPEG19.1 kBthis quality
PNG (lossless)151.8 kBsame pixels, exact
SMALLER BY7.9×than lossless
PSNR28.0 dBclearly damaged
originalJPEG 40%
divider

Save it again, and again.

Each save is a new round of loss. Your browser re-saves the scene above 30 times in four ways. Saving at the same settings settles quickly; moving the picture by one pixel, resizing it or switching codec between saves keeps eating away at it.

Same settingsShift 1 pxResize 90% and backJPEG, then WebPquality75%90%measured in your browser · 120 real encodes
Original
1 save31.6 dB
3 saves30.8 dB
10 saves30.4 dB
20 saves30.4 dB
30 saves30.4 dB
PSNR AGAINST THE ORIGINAL, PER SAVE
way of saving1 save10 saves30 saves
Same settings31.6 dB30.4 dB30.4 dB
Shift 1 px31.6 dB27.9 dB27.6 dB
Resize 90% and back23.2 dB20.6 dB19.8 dB
JPEG, then WebP31.6 dB28.0 dB25.9 dB

At the same settings, save 30 measured 30.4 dB against 31.6 dB for save 1: most of the loss happens on the first save, because the encoder keeps making the same choices. Resize 90% and back did the most damage, falling to 19.8 dB, because each save sees a slightly different picture and rounds it differently.

Listen to what was thrown away.

Subtract the decoded sound from the original and what remains is exactly what the encoder removed. Your browser encodes an 8-second clip with Opus at four bitrates, decodes each one, lines it up to the sample and plays the difference.

Test musicmeasured in your browser · Opus, mono 48 kHz
bitratefilekept / lostlost levelkept up to
12 kbit/s12.1 kB9.4 dB-27 dBFS8.3 kHz
24 kbit/s24.6 kB9.5 dB-27 dBFS20.1 kHz
48 kbit/s48.7 kB12.5 dB-31 dBFS20.1 kHz
96 kbit/s96.9 kB16.0 dB-34 dBFS20.1 kHz

"Kept / lost" is the signal-to-noise ratio between the original and what was removed, in dB. "Lost level" is the loudness of the removed part, against full scale. "Kept up to" is the highest band where the decoded sound is within 15 dB of the original.

music_noteOriginalgraphic_eqAfter Opusremove_circleWhat was removed
originalafter Opuswhat was removed

At 24 kbit/s the file is 24.6 kB, 31× smaller than 16-bit WAV. What was removed sits 9.5 dB below the music while the full frequency range is kept. That number looks poor for a reason: Opus keeps the loudness of each frequency band, but rebuilds noisy sounds like the hi-hat as similar-sounding noise rather than the same waveform, and subtraction counts all of that as removed. Your ear hears the same hiss. The "removed" playback is normalised to half of full scale. The decoded sound came out 1 sample late; the page lined it up before subtracting.

What each lossy codec throws away

codechow it splits the datawhat gets thrown awaylossless sibling
JPEGimage8×8 pixel blocks, colour split from brightnessHalves colour resolution in both directions (4:2:0), then rounds each block’s frequency coefficients by a quality table: fine, high-frequency detail is rounded to zero first.PNG, JPEG-LS
WebP (lossy, VP8)image16×16 macroblocks, 4×4 transformsPredicts each block from its neighbours, keeps only the error, quantises it; colour always at 4:2:0.WebP lossless
AVIF (AV1)imageBlocks from 4×4 up to 128×128Large flat areas get large blocks and few bits; grain can be removed and described as a film-grain model instead of stored.AV1 lossless mode
MP3audio576-sample granules, 32 sub-bandsSounds masked by louder nearby sounds, and with most encoders everything above about 16 kHz at 128 kbit/s.FLAC, WAV
AAC-LCaudio1,024-sample MDCT framesMasked detail, as MP3, with finer frequency resolution. HE-AAC rebuilds the top octave from a few parameters instead of storing it.ALAC
Opusaudio2.5-60 ms frames; SILK for speech, CELT for musicKeeps the energy of each band exactly and approximates the fine detail inside it, which is why low bitrates sound dull rather than metallic.none (use FLAC)
H.264 / AVCvideoMacroblocks, motion vectors between framesMost frames store only motion and a rounded correction, so detail that changes every frame (grain, rain, confetti) suffers most.FFV1, lossless H.264 profile
HEVC / AV1 videovideoLarger, flexible blocks and more prediction modesThe same kinds of loss as H.264, spread more efficiently: about the same picture at roughly half the bits on typical footage.FFV1
Re-encodinganyDecode, then encode againEvery lossy-to-lossy conversion is another round of rounding, as the 30-save test above shows. Converting lossy to lossless keeps the damage and only makes the file bigger.-

Frequently Asked Questions

Does lossy compression always reduce quality?

Yes, but at moderate settings the quality loss is barely noticeable. At high quality settings (JPEG 85%), most people cannot see the difference.

Can I reverse lossy compression?

No. Lossy compression permanently discards data. You cannot recover the lost information.

How many times can I save a JPEG?

Every JPEG save causes quality degradation. For editing, use PNG or work in a non-destructive format. Only convert to JPEG for the final output.

What quality setting should I use for JPEG?

85% quality is the sweet spot for most web images - excellent quality with significantly smaller file size than 100%.

Is lossy compression bad?

Not at all. For photos, music, and video, modern lossy compression at good settings is virtually indistinguishable from lossless, with 5-100x smaller file sizes.