How Does File Compression Work? ZIP, RAR and 7z Compared
Behind the compression we use every day to bundle a folder into one smaller file is a clever idea.
File compression means re-encoding data so it takes up less space. It is used both to bundle many files into a single archive and to make files smaller for email and uploads.
How does it work?
Compression finds repetition in data and writes it more briefly, like writing “10×A” instead of “AAAAAAAAAA”. Real algorithms find much more complex patterns, but the idea is the same. Archives such as ZIP use lossless compression: when you extract them, the files come back exactly, bit for bit.
Which files shrink, and by how much?
- Shrink a lot: text, documents, spreadsheets, source code, uncompressed images (BMP, TIFF).
- Shrink little or not at all: JPG, MP4, MP3, PNG and already compressed PDFs. These formats are compressed internally, so compressing them again barely changes their size.
ZIP, RAR and 7z
| Format | Notes |
|---|---|
| ZIP | The most common format. Windows and macOS open and create it without extra software. |
| RAR | Good compression and error recovery. Creating it usually needs WinRAR. |
| 7z | The format of the open source 7-Zip program. Often achieves high compression. |
For files you share, ZIP is the safest choice because the other person does not need to install anything.
Creating a ZIP in Windows
Select files or folders, right-click and choose Compress to → ZIP file. To open one, right-click the ZIP file and choose Extract all. Recent Windows versions can also open other archive formats such as 7z and RAR.
Password-protected archives
The 7z and RAR formats support encrypting the archive with strong encryption (AES-256). You can use this when sharing sensitive files; send the password through a different channel, not in the same message as the file.
Frequently asked questions
Why doesn’t a video get smaller when I zip it?
Because video formats like MP4 are already compressed. To shrink a video, you need to re-encode it at a lower resolution or bit rate.
Can a damaged archive be recovered?
Sometimes. RAR’s recovery record feature can help; with other formats the chances are lower.