ZIP and TAR both turn many files into one, but they come from different worlds. ZIP grew up on PCs and compresses each file as it adds it. TAR grew up on Unix and only bundles; compression is applied afterwards by a separate tool, which is where names like .tar.gz come from.
How TAR works
TAR (tape archive) dates back to 1979 Unix and was designed for writing to tape. It stores each file as a 512-byte header followed by the file's data, one after another, with no index at the end. A plain .tar file is not compressed at all.
To compress it, the whole TAR stream is passed through a compressor:
.tar.gzor.tgz: gzip (Deflate), the most common.tar.bz2: bzip2, smaller but slower.tar.xz: xz (LZMA2), smaller still.tar.zst: Zstandard, fast with good ratios
How ZIP works
ZIP compresses each file individually and writes an index, the central directory, at the end of the archive. A reader can list the contents and pull out a single file without touching the rest. See What is a ZIP file? for the details.
Key differences
| Feature | ZIP | TAR + gzip |
|---|---|---|
| Compression | Per file, built in | Whole archive, by a separate compressor |
| Many small, similar files | Good ratio | Often a little better, because files are compressed together |
| Listing contents | Fast; reads the index | Must decompress and read the whole stream |
| Extracting one file | Fast | Must read through everything before it |
| Damage | Usually limited to the affected file | Can make everything after the damaged point unreadable |
| Unix permissions and symlinks | Supported by some tools; ownership usually not kept | Fully supported; the format was built for it |
| Streaming | Possible, but the index is written last | Natural; designed for pipes and tapes |
| Built-in support | Windows, macOS, Linux, iOS, Android | Linux and macOS; Windows 10 and 11 via the tar command; recent Windows 11 in File Explorer |
Common commands
# ZIP
zip -r archive.zip folder/
unzip -l archive.zip
unzip archive.zip -d destination/
# TAR + gzip
tar -czf archive.tar.gz folder/
tar -tzf archive.tar.gz
tar -xzf archive.tar.gz -C destination/In tar, c creates, x extracts, t lists, z uses gzip and f names the archive file. The folder given to -C must already exist. GNU tar and bsdtar detect the compression when extracting, so tar -xf archive.tar.gz works too.
Which should you use?
- Sharing with people on Windows, Macs or phones: ZIP.
- Linux software, source releases and server backups:
.tar.gzor.tar.xz, because they keep permissions and symlinks and every Unix system hastar. - Frequently grabbing single files from a big archive: ZIP, thanks to its index.
- Squeezing many small text files as small as possible:
.tar.xzusually beats ZIP.
Converting between ZIP and TAR
TAR to ZIP turns .tar, .tar.gz or .tgz files into a ZIP that opens natively on Windows and macOS, keeping folders and timestamps. ZIP to TAR goes the other way, producing .tar or .tar.gz with Unix permissions kept and long or non-English names preserved through pax headers. Both run locally in your browser.