Skip to main content

zip

ZIP vs 7z vs TAR.GZ: Which Archive Format Should You Use?

robinhood-projects10 min read

Compress Files

Compress one or more files into a ZIP or TAR.GZ archive

Use Tool β†’

Extract ZIP

Open and extract files from ZIP archives

Use Tool β†’

Repack Archive

Select specific files from a ZIP archive and download a new ZIP with only those files

Use Tool β†’

For sharing files with other people, use ZIP: it opens on every major operating system without extra software. For the smallest file, use 7z, if the recipient can install 7-Zip. For Linux and macOS backups, deployments and source code where permissions must survive, use TAR.GZ. RAR is a format you will meet far more often than you should create.

That is the short answer to the ZIP vs 7z vs TAR.GZ question. The reasons behind it are worth knowing, because the wrong choice can silently strip executable bits from your scripts, leave a "password-protected" archive open to anyone who can read the file list, or produce a file your colleague cannot open. This guide compares the formats on the things that actually matter, then gives you a decision list.

The Quick Comparison

ZIP7zTAR.GZ
Compression algorithmDeflate (usually)LZMA2 (usually)Deflate (gzip) over a tar stream
Typical compression ratioGoodBest of the threeGood, similar to ZIP
Compression speedFastSlowest, uses the most memoryFast
Solid compressionNo, per-fileYes, by defaultEffectively yes, one stream
Open a single file without unpacking everythingYesSlower, depends on solid blockNo, must read through the stream
Built into WindowsYesRecent Windows 11 builds can open ittar command included; recent Windows 11 builds can also open it
Built into macOSYesNo (needs a third-party app)Yes
Built into LinuxYes, via common toolsNeeds p7zip or 7-Zip installedYes
Built-in encryptionYes (weak legacy or AES-256)AES-256 with optional file name hidingNo
Preserves Unix permissions and symlinksPartly, tool dependentLimitedYes

"Typical" here describes how the formats are designed to behave. Actual numbers depend on your data, the compression level and the software, so test on your own files before standardising on anything.

How Each Format Compresses

Understanding this explains almost every difference in the table. For a broader primer, see How File Compression Works.

ZIP: each file on its own

ZIP compresses every file separately, usually with Deflate, and stores a directory of entries at the end of the archive. Two consequences follow. You can extract one file from a huge archive quickly, because the program reads the directory and jumps straight to that entry. You can also add or remove files without rebuilding everything. The cost is that ZIP cannot exploit similarity between files. A folder of 5,000 near-identical config files compresses no better than 5,000 unrelated ones.

7z: one big block

7z defaults to LZMA2 and, by default, compresses many files together as a single solid block. When files resemble each other, such as source code, log files or versions of the same document, the algorithm finds repeats across file boundaries and the archive gets significantly smaller. The trade-offs are real. Compression is slow and memory-hungry at high settings. Extracting one file from the middle of a solid block means decoding everything before it in that block. And damage to a solid block can affect more files than damage to a ZIP entry.

TAR.GZ: two tools stacked

TAR alone does not compress anything. It concatenates files into a single stream while recording their metadata. Gzip then compresses that whole stream. Because gzip sees one continuous stream, the result is solid in practice, although gzip's small window means it finds fewer long-range repeats than LZMA2 does. Because there is no index, listing or extracting one file requires reading through the compressed stream until you reach it.

If you have seen .tar.xz or .tar.zst, those are the same idea with a stronger or faster compressor in place of gzip.

Compatibility: Who Can Open It?

This is the factor that decides most real-world choices.

  • ZIP is supported by Windows, macOS, Linux, Android and iOS file managers, and by every mainstream mail and chat client's preview features. If you do not know what the recipient uses, ZIP is the only safe default.
  • 7z requires 7-Zip (Windows, and a command-line build for Linux and macOS), or an app that supports it, such as Keka on macOS or PeaZip. Recent Windows 11 releases added native 7z reading, but you should not assume the recipient has them.
  • TAR.GZ is native on Linux and macOS and is the standard way to distribute Unix source code. Windows 10 and 11 include a tar command, so technical Windows users can handle it. Less technical users will often be puzzled by the double extension.

Passwords and Encryption: Read This Before You Rely on It

Encryption is where archive formats most often give a false sense of security.

ZIP supports two schemes. The original ZipCrypto is weak and known to be breakable, so treat a ZipCrypto password as a deterrent against casual snooping, not protection. The newer AES-256 option in ZIP is strong, but older extractors (including some built-in OS tools) cannot open it. In either case, file names are stored unencrypted, so anyone can see what is inside even if they cannot open it.

7z uses AES-256 and, if you enable header encryption (the -mhe=on switch in 7-Zip), also encrypts the file list. This is the strongest option of the three for confidential archives, provided the recipient has software that opens 7z.

TAR.GZ has no encryption at all. People typically encrypt the archive afterwards with a separate tool such as GPG or age.

Whatever format you use, a strong encryption algorithm is only as good as the password. Use a long passphrase, and send it through a different channel from the file.

One honest note about FileCrank: the Compress Files tool currently creates ZIP and TAR.GZ archives without password encryption, so do not rely on it for protection. To make an encrypted archive, create it locally with 7-Zip.

If your files are going to run on a Unix system, this matters more than compression ratio.

TAR was built for it. It records permission bits (such as the executable flag), owner and group, modification times and symbolic links. Extract it on another Linux machine and your deploy script is still executable. ZIP can store Unix permissions in its metadata, but support varies by tool, and archives created on Windows carry none, so shell scripts often lose their executable bit when unzipped. 7z support for Unix permissions exists in some builds but is not something to depend on.

Practical commands:

# Create a TAR.GZ, preserving permissions and symlinks
tar -czf project.tar.gz project/
 
# List contents without extracting
tar -tzf project.tar.gz
 
# Extract (use -p to keep permissions when not running as root)
tar -xzpf project.tar.gz
 
# Create a ZIP that stores symlinks as links, not copies of their targets
zip -r -y project.zip project/
 
# Create a 7z with maximum compression, encrypted names and contents
7z a -t7z -mx=9 -mhe=on -p secure.7z project/

On macOS, archives made by the Finder's Compress option, and tar by default, may include __MACOSX folders or ._ files holding extended attributes. They are harmless on a Mac but look like clutter on Windows and Linux. Setting COPYFILE_DISABLE=1 before running tar stops the ._ files from being created.

Speed and Resource Use

Rather than quoting numbers that vary by machine, here is how to reason about it:

  • ZIP and TAR.GZ at default settings are fast and light on memory, which is why they dominate automated pipelines.
  • 7z at high levels trades time and RAM for a smaller file. It is a good deal when you compress once and download many times, such as distributing a release, and a poor deal for a nightly backup that no one reads.
  • Decompression is much faster than compression for all three. A 7z that took minutes to make usually unpacks in a fraction of that time.
  • Already-compressed content (JPEG, MP4, MP3, PDF with embedded images, and other archives) barely shrinks in any format. Don't waste a "best" setting on a folder of vacation videos.

What About RAR?

RAR is a proprietary format owned by RARLAB. It compresses well and supports recovery records for repairing damaged archives, which is why it persists on file-sharing sites and in older download collections. But only the official WinRAR and RAR tools can create it, and they are commercial software. Free tools, including 7-Zip, can read RAR files but not write them.

Treat RAR as read-only. If someone sends you a RAR, extract it. If you need to send something, pick ZIP, 7z or TAR.GZ. Be careful with archives from unknown sources, since any archive format can carry malicious files or deliberately oversized contents. The Dangers of Compressed Files and How to Extract Them Safely covers what to check first.

Which Format Should You Pick?

Use this checklist:

  1. Sending to a non-technical person, or you do not know their system? ZIP.
  2. Emailing a handful of documents? ZIP.
  3. Need the smallest possible file and the recipient can install 7-Zip? 7z.
  4. Archiving thousands of similar text files, logs or source files? 7z (or TAR with xz or zstd compression).
  5. Backing up or deploying a Linux or macOS directory with permissions and symlinks? TAR.GZ.
  6. Distributing open-source code for Unix users? TAR.GZ.
  7. Need real encryption with hidden file names? 7z with header encryption, or TAR plus GPG.
  8. Need to open a single file from a large archive often? ZIP.
  9. Received a RAR? Extract it with 7-Zip, and re-pack as ZIP or 7z if you need to share it onward.

Doing It Without Installing Anything

For the common cases, you do not need to install software.

  1. Create an archive. Open Compress Files, add your files, choose ZIP or TAR.GZ, pick a compression level (none, fast, normal or best), set a name and download. "None" stores files without compressing, which is the right choice for media that will not shrink. Each uploaded file can be up to 50 MB.
  2. Look inside an archive before opening it. Extract ZIP shows the contents and lets you select which files to download. It supports ZIP files only, so for 7z, RAR or TAR.GZ archives, use a local tool such as 7-Zip.
  3. Shrink an existing ZIP or trim it down. Repack Archive lets you choose which files from a ZIP to keep and downloads a new ZIP containing only those files. This is useful when someone sends you a ZIP with a large folder you do not need.

As with every online service, uploaded files are processed on a server, and FileCrank deletes them automatically after about an hour. For very sensitive material, use a local tool instead.

Conclusion

No archive format wins on every axis. ZIP wins on compatibility and random access, 7z on compression and encryption, and TAR.GZ on fidelity for Unix files. Pick based on who will open the archive and what must survive the trip, not on which format sounds most advanced. When in doubt, ZIP is the format nobody has to ask how to open.

To bundle files now, try Compress Files. If you have an archive to inspect first, open it with Extract ZIP, and use Repack Archive to keep only the parts you need. No sign-up required.