How Compression Works

Lossless and lossy methods, redundancy, codecs and ratios.

Compression starts from one observation: many files hold more bytes than they need. A report repeats words, a photo has long stretches of similar color, and a log file repeats nearly identical lines. A compressor finds that repetition and writes the same information in fewer bytes. A decompressor reverses the process.

The guides in this topic start with the plain definition and then open the machinery. They cover lossless methods that give back every original byte, lossy methods that discard detail you are unlikely to miss, the ideas behind Huffman coding and DEFLATE, and the reason some files barely shrink at all. You will also learn how to read a compression ratio and what a codec is.

One article clears up a naming clash. The word compressor also names an audio tool that evens out loudness. This site is about data compression, and that article explains the difference. Each guide links to the compression ratio calculator, so you can try the arithmetic on your own sizes.

All 9 articles in this topic