Science & TechHow it works
How a ZIP file shrinks without losing a single bit.
Two tricks. First, the algorithm replaces repetitions with a back-reference: 'same as 200 characters ago, 15 characters long'. Second, frequent symbols get short bit codes and rare ones long codes, which is Huffman coding. ZIP and PNG combine both as 'Deflate'. All lossless, but not limitless: no method can shrink every file, and some even grow.
Useful: Zipping photos and videos again gains nothing: they are already compressed and contain few repetitions.
Source: en.wikipedia.org