UnpackForge

TAR vs ZIP

Tar and ZIP solve the problem in different orders. Tar only bundles files — compression is a separate layer applied to the whole bundle, giving .tar.gz or .tar.xz. ZIP compresses every file on its own and adds an index of them at the end. Almost every practical difference follows from that.

Do it in your browser, nothing uploaded

Side by side

TAR compared with ZIP
TAR (.tar, .tar.gz)ZIP
OriginVersion 7 Unix, 1979Phil Katz / PKWARE, 1989
Identified byustar at byte 257 (no signature at offset 0)50 4B 03 04 at offset 0
CompressionNone; gzip, bzip2, xz or Zstandard over the whole archivePer file; each entry names its method, such as DEFLATE
IndexNone — headers are walked one by oneCentral directory at the end
Extracting one fileA .tar.gz must be decompressed up to that fileDirect
Many small, similar filesSmaller when compressed: repetition across files countsEach file compressed alone
Unix metadataPermissions incl. setuid, owner, symlinks, hard links, devicesPermission bits and symlinks via Info-ZIP conventions; no devices
Timestamps1-second, or sub-second with PAX2-second DOS time with no time zone, unless an extra field adds more
StreamingNatural: tar -c dir | ssh host tar -xWriting needs data descriptors; reading wants the end of the file
EncryptionNoneZipCrypto (weak) or AES-256
Windowstar.exe since Windows 10 1803; File Explorer from Windows 11 23H2File Explorer since Windows Me and XP
macOS and LinuxBuilt in everywhereBuilt in on macOS; unzip on Linux where it is installed

When tar is the right choice

  • Unix file trees that must come back exactly — backups, source releases, container image layers. Owners, permission bits, symlinks and hard links survive.
  • Smallest size for many small files — a .tar.xz or .tar.gz of a source tree beats a ZIP of it, because the compressor sees across files.
  • Pipelines — tar reads and writes streams, so it can go straight over a network or into a compressor without a temporary file.

When ZIP is the right choice

  • Sending to Windows users — double-click works on every version, not only Windows 11.
  • Pulling single files out of a large archive — the central directory gives direct access without decompressing everything before it.
  • Password protection — ZIP has AES-256; tar has no encryption at all.
  • Updating in place — files can be added or removed by rewriting the central directory (zip -u, zip -d); a compressed tar must be rebuilt.

The same jobs, in both

tar -czf project.tar.gz project/     # create
zip -r project.zip project/

tar -tzf project.tar.gz              # list
unzip -l project.zip

tar -xzf project.tar.gz -C out/      # extract into out/
unzip project.zip -d out/

Converting between them keeps every file byte for byte. TAR to ZIP compresses the contents and keeps timestamps and read, write and execute bits; ownership, device nodes and symbolic links do not cross, and hard links become copies. ZIP to TAR writes USTAR with PAX headers where a path needs one.

Questions

Is tar.gz better than ZIP?

Smaller for many small similar files, and better at preserving Unix metadata. Worse for pulling out one file, and less convenient on older Windows. For sending to arbitrary people, ZIP; for Unix backups and source releases, tar.gz or tar.xz.

Does tar compress files?

No. Tar bundles; gzip, bzip2, xz or Zstandard compresses the bundle. A plain .tar is about the size of its contents plus headers.

Can ZIP keep Unix permissions?

Partly. Info-ZIP records permission bits in each entry's external attributes and unzip restores them, but ownership, device nodes and setuid bits are not carried portably. Tar keeps all of them.

How do I convert a tar to a ZIP?

In a browser, with the TAR to ZIP or TAR.GZ to ZIP converter here — nothing to install, nothing uploaded. On the command line, extract with tar -xf and re-pack with zip -r.