ZIP, GZIP, TAR, 7z and RAR explained
What each archive format does, where it opens without extra software, and which one to use for a given job.
Archive formats do two separate jobs that are easy to confuse: bundling many files into one, and compressing data to make it smaller. Some formats do both, some do only one, and knowing which is which explains most of the confusion around .zip, .gz, .tar.gz, .7z and .rar.
Bundling versus compressing
A bundle is a single file that contains other files with their names and folder structure. Tar does exactly this and nothing else: a .tar file is not compressed at all. A compressor takes one stream of data and makes it smaller. Gzip does exactly this and nothing else: a .gz contains exactly one compressed file. ZIP, 7z and RAR do both at once, compressing each file and bundling them together.
This is why the Unix world has .tar.gz: tar first to bundle, gzip second to compress. It is also why a .gz file downloaded from a server is just one file once decompressed.
The formats
| Format | Bundles? | Compresses? | Opens without extra software on | Typical use |
|---|---|---|---|---|
| ZIP | Yes | Yes (DEFLATE) | Windows, macOS, iOS, Android, Linux | Sending and sharing files; the universal choice |
| GZIP (.gz) | No | Yes (DEFLATE) | macOS, Linux; not Windows | Web assets, logs, database dumps, single large files |
| TAR | Yes | No | macOS, Linux; not Windows | Preserving Unix permissions and structure |
| TAR.GZ / .tgz | Yes | Yes | macOS, Linux; not Windows | Software source, server backups, Linux packages |
| 7z | Yes | Yes (LZMA) | None natively; needs 7-Zip or similar | Maximum compression for large archives |
| RAR | Yes | Yes (proprietary) | None natively; needs WinRAR or an extractor | Legacy downloads, multi-part archives |
How much smaller do files actually get
All of these formats work by finding repetition. Text, spreadsheets, code, logs and uncompressed images and audio are full of repetition and shrink dramatically. Files that are already compressed, which includes JPG, PNG, MP3, MP4, PDF and modern Office documents (which are ZIP files internally), have had their repetition removed already and barely shrink at all.
| Content | ZIP / GZIP | 7z (LZMA) |
|---|---|---|
| Plain text, CSV, logs | 75 to 90% smaller | 80 to 93% smaller |
| Source code | 70 to 85% | 78 to 90% |
| WAV audio, BMP images | 30 to 60% | 35 to 65% |
| Office documents | 5 to 15% | 10 to 20% |
| JPG, MP4, MP3, PDF | 0 to 3% | 0 to 5% |
The practical lesson: zipping a folder of photos makes one convenient file but not a smaller one. To reduce the size of a photo set, compress the images themselves first with the image compressor, then zip them for delivery.
Which to use
- Sending files to anyone: ZIP. Everyone can open it, on every device, with nothing installed. Make one with the ZIP tool.
- A single large file for a server, a pipeline or a data import: GZIP. It is what servers and tools expect. See the GZIP tool.
- Backing up a Linux or macOS folder with permissions intact: TAR.GZ.
- Archiving something huge where every megabyte counts and the recipient is technical: 7z.
- Opening an old download: RAR needs an extractor such as 7-Zip; there is no reason to create new RAR files today.
Password-protected archives
ZIP's original password protection is weak and can be broken quickly; ZIP with AES encryption (offered by 7-Zip and WinZip) and 7z's built-in AES are strong. If you need to protect a file rather than merely bundle it, use AES and share the password through a different channel from the archive itself. Browser-based tools, including the ones on this site, cannot open encrypted archives because the contents are unreadable without the key.
Opening archives without installing software
Windows opens ZIP natively but not .gz, .tar or .7z. macOS opens ZIP, .gz and .tar.gz but not .7z or .rar. For ZIP and .gz on any device, the unzip and gunzip tools here open them in your browser and let you download the contents without anything being uploaded.