A tarball is a single file that holds multiple files and folders compressed together, usually for easier download or storage

A tarball (or tar file) is a container — think of it like a digital box that holds many items packed tightly together. The name comes from "tape archive," because the format was originally designed to back up data to magnetic tape. Today, tarballs are everywhere: software downloads, system backups, and file transfers all use them because they shrink the total size and keep everything organized in one place.

When you download a tarball, you are getting one file instead of dozens or hundreds. Your computer unpacks it to get the original files back. The most common type you will see is a compressed tarball, which uses additional compression (usually gzip or bzip2) to make the file even smaller. These show up with names like filename.tar.gz or filename.tar.bz2.

Key Takeaways

  • A tarball bundles multiple files and folders into a single container file, making downloads and transfers simpler.
  • Compressed tarballs (ending in .tar.gz or .tar.bz2) are smaller than uncompressed ones and are the most common format you will encounter.
  • You unpack a tarball using built-in tools on Windows, Mac, or Linux — no special software purchase required.
  • Tarballs preserve folder structure and file permissions, so everything unpacks exactly as the creator intended.

How a tarball differs from a zip file

Both tarballs and zip files bundle multiple items into one, but they work differently. A zip file compresses everything in a single step and is more common on Windows. A tarball first collects all the files (the "tar" step), then optionally compresses them (the "gzip" or "bzip2" step). This two-step approach lets you compress a tarball with different methods or not compress it at all.

Tarballs also preserve Unix file permissions — settings that control who can read, write, or run a file. When you unpack a tarball on a Mac or Linux machine, those permissions come back exactly as they were. Zip files do not always preserve these settings, which can cause problems if you are unpacking software or scripts. On Windows, this difference rarely matters because Windows uses a different permission system.

How to open a tarball on your computer

On Mac: Double-click the .tar.gz or .tar.bz2 file. The Archive Utility (built into macOS) unpacks it automatically. The files appear in the same folder as the tarball.

On Windows: Windows 10 and later can open .tar.gz files natively. Right-click the file, select "Extract All," and choose where to save the unpacked contents. For older Windows versions or if the right-click menu does not show an extract option, download 7-Zip (free, open-source software) and use it to open the tarball.

On Linux: Open a terminal, navigate to the folder containing the tarball, and type tar -xzf filename.tar.gz (for gzip compression) or tar -xjf filename.tar.bz2 (for bzip2 compression). The files unpack into the current folder.

When and why you will encounter tarballs

Software developers use tarballs to distribute source code and pre-built programs, especially on Linux and Mac. If you download open-source software from GitHub or a project website, you may get a tarball. System administrators use them to back up entire directory structures while keeping permissions intact. Web hosting companies often let you download your site files as a tarball for the same reason.

Tarballs are also standard for sharing large collections of files over the internet. Because they compress well and preserve folder structure, they reduce download time and make sure nothing gets lost or reorganized in transit. You might receive one from a colleague, a service you use, or a software project you want to try.

What happens when you unpack a tarball

Unpacking (or extracting) a tarball reverses the packing process. Your computer reads the tarball file, decompresses it if needed, and writes out all the original files and folders to your chosen location. The folder structure is restored exactly — if the tarball contained a folder called "project" with subfolders inside, unpacking creates that same structure on your computer.

After unpacking, the tarball file itself remains on your disk. You can delete it once you have confirmed the unpacked files are what you need. Some people keep the tarball as a backup or for re-downloading later, but it is not required.

Tarballs and security

A tarball is just a container, so it is only as safe as what is inside it. Before unpacking a tarball from the internet, check that it came from a source you trust. If you downloaded it from a project's official website or a direct link from a developer you know, the risk is low. If someone sent it to you unsolicited or you found it on an unfamiliar site, be cautious.

After unpacking, scan the contents before running any executable files or scripts. On Windows, if a file has an .exe extension, treat it the same way you would any program download — check the source first. On Mac and Linux, be careful with files that have execute permissions, especially if you do not recognize them. The tarball format itself does not add security risk beyond what the individual files inside carry.

Creating your own tarball

On Mac or Linux: Open Terminal, navigate to the parent folder of what you want to pack, and type tar -czf archive-name.tar.gz folder-name. This creates a compressed tarball called "archive-name.tar.gz" containing everything in "folder-name."

On Windows: 7-Zip can create tarballs. Right-click the folder you want to pack, select "7-Zip," then "Add to archive." In the dialog, change the archive format to "tar" and the compression method to "gzip" if you want .tar.gz format. Click OK to create the file.

Frequently Asked Questions

Can I open a tarball without unpacking it?

Yes, on Mac and Linux you can browse the contents of a tarball without unpacking it using the command line or a file manager. On Windows, 7-Zip lets you view files inside a tarball. However, you cannot edit or run files without extracting them first.

What is the difference between .tar, .tar.gz, and .tar.bz2?

.tar is uncompressed (larger file size). .tar.gz uses gzip compression (smaller, faster to download). .tar.bz2 uses bzip2 compression (even smaller, but slower to compress and decompress). For most purposes, .tar.gz is the standard choice.

Will unpacking a tarball overwrite files on my computer?

Only if you unpack it into a folder that already contains files with the same names. When you unpack, choose an empty folder or a new folder to avoid accidental overwrites. Most tarballs unpack into their own subfolder, so this is rarely a problem.

Do I need special software to open a tarball?

No. Mac and Linux have built-in tools. Windows 10 and later can open .tar.gz files natively. If your Windows version does not support it, 7-Zip is free and widely used.