Skip to content
Aback ZIP

Formats · 4 min read · Updated

ZIP vs TAR: what is the difference?

TAR bundles files, gzip compresses them, ZIP does both file by file. Learn how ZIP, .tar and .tar.gz differ and when each is the better choice.

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.gz or .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

FeatureZIPTAR + gzip
CompressionPer file, built inWhole archive, by a separate compressor
Many small, similar filesGood ratioOften a little better, because files are compressed together
Listing contentsFast; reads the indexMust decompress and read the whole stream
Extracting one fileFastMust read through everything before it
DamageUsually limited to the affected fileCan make everything after the damaged point unreadable
Unix permissions and symlinksSupported by some tools; ownership usually not keptFully supported; the format was built for it
StreamingPossible, but the index is written lastNatural; designed for pipes and tapes
Built-in supportWindows, macOS, Linux, iOS, AndroidLinux 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.gz or .tar.xz, because they keep permissions and symlinks and every Unix system has tar.
  • Frequently grabbing single files from a big archive: ZIP, thanks to its index.
  • Squeezing many small text files as small as possible: .tar.xz usually 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.

Tools for this

Frequently asked questions

Sometimes. gzip compresses the whole stream as one unit, while ZIP compresses each file separately, so for many small, similar files a .tar.gz is often a little smaller. For a few large files the sizes are nearly identical, since both use Deflate.

More guides