tar.gz vs zip: Which Archive Format Should You Use?

tar.gz compresses better and preserves Unix permissions; zip opens with a double click on any system.

Side by side

tar.gz zip
Compresses across files Yes — better ratio on many small files No, each file separately
Preserves Unix permissions Yes, fully Partially, often lost
Preserves symlinks Yes Inconsistently
Extract a single file Must read the stream up to it Instant — central directory
Opens natively on Windows/Mac Not without extra software Yes, double click
Streamable (pipe over SSH) Yes, by design No
Typical ratio, many small files Better Worse
Create tar -czf out.tar.gz dir/ zip -r out.zip dir/
Extract tar -xzf out.tar.gz unzip out.zip

Which one, when

Backing up a server directory

Use tar.gz

Permissions, ownership and symlinks survive, which is the whole point of a backup you intend to restore.

$ tar -czf "backup-$(date +%F).tar.gz" /var/www

Sending files to a client or colleague

Use zip

It opens with a double click on Windows and macOS with nothing installed. Sending a .tar.gz to a non-technical recipient creates a support ticket.

$ zip -r deliverables.zip designs/ -x "*.psd"

Migrating a directory between servers

Use tar.gz, streamed

tar streams, so the archive never touches disk on either end — it is created, transferred and extracted in one pipeline.

$ tar -czf - /var/www | ssh user@new "tar -xzf - -C /"

Distributing software downloads

Use both

Publish a .tar.gz for Linux users and a .zip for everyone else. It costs one extra command and removes a whole class of support questions.

$ tar -czf app.tar.gz app/ && zip -r app.zip app/

Archiving where you control both ends

Use tar.zst

Zstandard reaches near-xz compression at speeds that make gzip look leisurely. The best current default when compatibility is not a constraint.

$ tar --zstd -cf backup.tar.zst data/

Gotchas worth knowing

Frequently asked questions

Why does tar.gz compress better than zip?

gzip compresses the whole tar stream, so patterns repeated across files are exploited. zip compresses each file independently and loses that opportunity — the difference is largest with many small similar files.

Can Windows open tar.gz?

Windows 11 handles it natively, and 7-Zip has for decades. But "can be opened with the right tool" is a worse promise than "opens with a double click" when you do not control the recipient.

What about 7z?

Excellent compression, but it needs software installed on every platform. Worth it for large archives among people who already use it.

Is tar.zst ready for production?

Yes — zstd is in the mainline kernel and shipped by every major distribution. The only reason to hesitate is a recipient on a very old system.

Full guides for both

tar

Create and extract archives: tar.gz, tar.bz2 — with the flag combinations finally explained.

gzip & zip

Single-file compression (gzip family) vs portable archives (zip) — and when each.

Put it into practice

Extract a .tar.gz archive

Unpack tar.gz, tar.bz2, tar.xz and zip archives from the command line.

Other comparisons

rsync vs scp

Both copy files over SSH. rsync sends only what changed; scp sends everything, every time.

curl vs wget

curl is an HTTP client for talking to services; wget is a downloader for retrieving files.

sed vs awk

sed edits lines; awk understands columns. Substitution is sed, computation is awk.

symbolic link vs hard link

A symlink stores a path and can break; a hard link is a second real name for the same file.