ZIP is Not Compression

5-minute read

I was watching a podcast of Lex Fridman. He interviewed Jean-Baptiste Kempf and Kieran Kunhya. Kempf is the lead developer of VLC and president of VideoLAN. Kunhya is a longtime FFmpeg contributor, codec engineer, and the person behind the now-infamous FFmpeg account on X.

During the podcast I was amazed by every piece of information they talked about and the explanations they gave. Then Kempf said this:

A zip is that you have data in you get data out

Of course, that’s true for any file, but what he meant was that ZIP is just a container, not the compression itself. That got me thinking why not make a simple post about this line to share my understanding?

Wikipedia defines a ZIP as an archive file format that supports lossless data compression. A ZIP file may contain one or more files or directories that have been compressed. The format permits a number of compression algorithms, though DEFLATE is the most common.

So ZIP is an archive format that uses compression to reduce file size. It helps you save space on your device and speed up file transfers. It works by packing one or more files into a single “zipped” folder.

I use ZIP personally when I want to save disk space or transfer a folder full of Anime episodes, Series, or Movies. When I zip a folder of episodes, the compression works because video often has repeated background scenes—the same sky, the same walls—that can be represented more efficiently. This makes it easier to share multiple files at once, especially when dealing with large datasets or folders.

But what does “compression” actually mean?

Data compression is the process of encoding information using fewer bits than the original representation. It can be either lossy or lossless.

Lossy compression reduces bits by removing unnecessary or less important information. Think of MP3s or JPEGs you save more space, but you can’t get the original back.

Lossless compression reduces bits by identifying and eliminating statistical redundancy. By redundancy, I mean repeating patterns or predictable information that can be represented more efficiently. No information is lost, so the process is reversible. That’s why you can zip a document and unzip it later with every word exactly as you wrote it.

A basic example: an image may have areas of color that don’t change over several pixels. Instead of coding “red pixel, red pixel, …” the data may be encoded as “279 red pixels”. This is called Run-Length Encoding, a simple form of lossless compression. ZIP uses a more advanced method called DEFLATE, which I’ll cover in a future post. There are many other schemes to reduce file size by eliminating redundancy.

So to summarize: a ZIP file is a way to store compressed data. It can contain one or more files or directories that have been compressed. In ZIP you have data in and data out, but the compression itself can be done in many ways using different methods and algorithms.

One reason ZIP is so popular is that it’s built into almost every operating system, making it the easiest way to share compressed files without needing extra software.

So next time you zip a file, remember: the magic isn’t in the ZIP itself. It’s in the math behind it, math that finds patterns you didn’t even know were there. And in my next post, I’ll show you exactly how DEFLATE does it.

Thanks for reading. See you later.