Data compression changes how information is represented so that a file can use fewer bits. It works especially well when a representation contains patterns or details that can be encoded more economically.
There are two fundamentally different promises a compressor can make. A lossless method restores the original data exactly. A lossy method allows information to be discarded according to a chosen design and quality target.
Repetition can be described instead of copied
Imagine a message containing a long repeated run of the same symbol. A representation giving the symbol and a count may be shorter than writing it repeatedly. Real formats need rules for recognising that representation and handling cases where the pattern is absent.
Dictionary methods use a related idea: refer to an earlier sequence rather than copy it again. The decompressor follows the agreed rules to rebuild the original bytes. Nothing needs to be remembered outside the encoded data and the defined decoding process.
Some symbols deserve shorter codes
An encoding can assign shorter descriptions to frequent symbols and longer descriptions to less frequent ones. Huffman coding is one established method for doing this with a decodable code structure.
The DEFLATE specification combines LZ77-style references with Huffman coding. It is a concrete example of a format using more than one technique, rather than one universal formula that makes every file smaller by the same percentage.
Lossless compression has a mathematical limit
For all possible files of a fixed length, there cannot be a unique shorter representation for every one: there are fewer shorter bit strings available than original strings. Some inputs must fail to shrink or must expand once format overhead is included.
This is why compressing an already compressed file often achieves little. Its remaining representation may offer few useful patterns to the next compressor. A smaller output is not guaranteed merely because another archive layer is added.
Lossy methods make a different choice
Image, audio and video formats can reduce data by approximating parts of the signal. The method may exploit limits of perception, but a visually subtle change is still a change in the stored information.
Quality depends on the codec, settings and content. Converting a previously lossy image into a lossless format preserves its current data; it cannot recover details already discarded. Repeated lossy editing and saving can introduce further degradation.
Smaller is not the only requirement
A useful format also needs reliable decoding, appropriate quality and compatibility with the intended use. Scientific measurements and archival masters may require exact preservation even when a smaller display copy is acceptable.
Library and Archives Canada distinguishes lossless and lossy approaches in preservation guidance. Choosing between them starts with what must be recoverable, not simply which file occupies the fewest bytes on a disk.
Explore a related question
How Transistors Switch and Amplify Electronic Signals
Sources and further reading
Keep exploring.
One remarkable idea at a time—nature, science, history and beyond.
Last updated October 27, 2026.



