A tarball is a single file that holds many other files and folders compressed together
A tarball is a file that bundles multiple files and directories into one archive, usually with compression applied to make it smaller. The name comes from its original format: "tar" (tape archive) combined with compression, often creating a file that ends in .tar.gz or .tar.bz2. You'll see tarballs most often when downloading software, backing up folders, or receiving files from Linux and Mac users.
The key difference between a tarball and other archive formats like ZIP is that tar was originally designed to preserve file structure and permissions — details that matter more on Linux and Unix systems. When you extract a tarball, you get back not just the files but also the folder organization and, on Linux systems, the original file permissions.
Key Takeaways
- A tarball is a compressed archive that holds many files and folders in a single package, usually ending in .tar.gz or .tar.bz2.
- On Windows, you can open tarballs with 7-Zip (free), WinRAR, or built-in tools in Windows 11; on Mac and Linux, right-click and extract or use the command line.
- Tarballs preserve folder structure and file permissions better than ZIP files, which is why they're standard for software distribution on Linux.
- The "tar" part bundles files together, and the "gz" or "bz2" part compresses them; you need to decompress to use the files inside.
How tarballs are named and what the extensions mean
A tarball filename tells you what compression method was used. A file ending in .tar.gz (also written as .tgz) contains files bundled with tar and then compressed with gzip. A file ending in .tar.bz2 uses bzip2 compression instead, which often creates a smaller file but takes longer to compress and decompress. You might also see .tar.xz, which uses xz compression and is even more compact.
The compression method matters only when you're extracting — your computer handles the decompression automatically. You don't need to choose which tool to use based on the extension; the extraction tool you pick will handle any of these formats.
Opening a tarball on Windows
Windows 10 and earlier do not have built-in tarball support, but Windows 11 can extract them natively: right-click the file, select "Extract All", and choose where to put the contents. If you're on an older Windows version or prefer a dedicated tool, 7-Zip is free and handles tarballs reliably. Download it from 7-zip.org, install it, then right-click your tarball and choose "7-Zip" > "Extract Here" or "Extract to [folder name]".
WinRAR is another option if you already own it, though it costs money. Both tools will create a folder with the extracted files in the same location as the tarball. If you extract a file called software.tar.gz, you'll get a folder called software (or sometimes software.tar as an intermediate step, depending on the tool).
Opening a tarball on Mac and Linux
On a Mac, double-click the tarball and it extracts automatically — the system has built-in tar support. You'll see a new folder appear in the same location. If that doesn't work, open Terminal, navigate to the folder containing the tarball, and type tar -xzf filename.tar.gz (replacing "filename" with the actual name). The -x means extract, -z means decompress with gzip, and -f means read from a file.
On Linux, the process is the same: right-click and extract if your file manager supports it, or use the Terminal command above. For .tar.bz2 files, use tar -xjf filename.tar.bz2 instead (the -j tells tar to use bzip2 decompression). Linux and Mac preserve file permissions during extraction, so executable files stay executable.
Why you'll encounter tarballs and what's inside
Tarballs are the standard way to distribute source code and software on Linux. If you download a program from GitHub or a Linux project site, it often comes as a tarball. They're also common for backups and for sharing large folder structures where preserving the exact organization matters.
Inside a tarball you might find source code files, documentation, configuration files, or a complete application ready to install. You won't know what's inside until you extract it, but the filename usually hints at the contents — something like wordpress-6.4.tar.gz tells you it's WordPress version 6.4.
The difference between tar and compression
It's worth understanding that tar and compression are two separate steps. Tar bundles files into a single archive while keeping the folder structure intact. Compression (gzip, bzip2, or xz) then squeezes that archive to make it smaller. A .tar file by itself is not compressed — it's just bundled. A .tar.gz file is both bundled and compressed.
In practice, you almost never see a plain .tar file anymore because compression is so useful. But if you do encounter one, extract it the same way: right-click and extract on Windows 11 or Mac, or use tar -xf filename.tar on the command line (without the -z or -j flags).
What to do if extraction fails
If a tarball won't extract, the file might be corrupted or incomplete. Try downloading it again from the source. If you're on Windows and using 7-Zip, make sure you have the latest version — older versions sometimes struggle with certain compression methods.
If you're using the command line and get an error like "gzip: stdin: not in gzip format", the file might be mislabeled. Try extracting with tar -xf filename.tar.gz (without the -z) to let tar figure out the compression automatically. On Mac and Linux, you can also try file filename.tar.gz to see what the system detects the file actually is.
Frequently Asked Questions
Is a tarball the same as a ZIP file?
No. Both bundle files together, but tarballs preserve Linux file permissions and folder structure more reliably. ZIP is more common on Windows. For most everyday use, they work similarly — you extract and get your files back.
Can I open a tarball on my phone?
Most phones don't have built-in tarball support. On Android, apps like ZArchiver can extract them. On iPhone, you'd need to transfer the file to a computer first or use a cloud service that supports extraction.
What if the tarball extracts to a .tar file first?
Some tools extract in two steps: first removing the compression layer (leaving a .tar file), then extracting the tar archive itself. This is normal. Extract the .tar file the same way, and you'll get your actual files.
Do I need to keep the tarball after extracting it?
No. Once extracted, you can delete the tarball if you don't need a backup. The extracted files are independent copies.
Why do some downloads use tarballs instead of ZIP?
Linux developers prefer tarballs because they preserve file permissions — important for executable programs. ZIP doesn't handle Unix permissions well, so tarballs remain standard in that community.