How do Zip files (archives) work?

One of the wonders of the computer are the zip files. These technological wonders help compress bulky large files into much smaller files than they originally were.

But, ever wondered what they are and how they work?

Without getting into much technical stuff, lets explain to you by comparing two sentences below.

Original Sentence

The lacuna Blog is founded by Sk Nepal. The lacuna Blog is a hobby of Sk Nepal. Now Sk Nepal runs The Lacuna Blog actively and everyone loves The Lacuna Blog.

This is a simple sentence and it contains about 100 letters, but we can compress it.

How? Lets replace The Lacuna Blog with TLB, is with Z and Sk Nepal with SN.

Replaced Sentence

TLB Z founded by SN. TLB Z a hobby of SN. Now SN runs TLB actively and everyone loves TLB.

What difference do you see? Obviously, the second one is much smaller to about 60 letters.

Zip files work in much similar way, they simply replace words with certain hex codes and add a dictionary to them to tell the zip reading software what was replaced with what.

Text file with a lot of a

Don't believe, me? Lets try an experiment.

Make a new text file on your computer and enter a lot of 'a' in the text file (as much as you can). Now, save it and notice the size of the text file. Then, compress it to an archive, and notice the archive's size. No matter how many a's you put in the text file and whatever size the text file may be, your zip file will never be more than 1 kilobytes.

Zipped File

Sign Up for Free Newsletter

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>