TAR.GZ vs TAR.XZ vs TAR.BZ2: Which Linux Archive Should You Use?
The three compressed TAR flavors compared: compression ratio, speed, memory use and when each one is the right choice.
ilove7z Team · Sep 24, 2026 · 4 min read
Every Linux release, source package and backup script eventually ships as a file with two extensions stacked together. Here is what the second one actually means and which of the three you should pick.
Why TAR gets a second extension
TAR itself does not compress anything. It is a bundler: many files glued into one stream, preserving Unix permissions and directory structure. The second extension names the compression filter applied to that stream:
.tar.gz- TAR compressed with gzip.tar.bz2- TAR compressed with bzip2.tar.xz- TAR compressed with XZ (LZMA2)
Same idea as zipping a folder, but the two steps stay visible in the name.
The three contenders
gzip is the default everywhere. Decompression is nearly instant, tooling is universal, and every Unix-like system since the 1990s can read it blindfolded. Compression is modest by modern standards.
bzip2 trades speed for size with its block-sorting algorithm. It often beats gzip by 10-20% on text-heavy trees, but compression is several times slower and decompression noticeably heavier too.
XZ (LZMA2) is the modern heavyweight. It produces the smallest files of the three - often 30-50% below gzip - at the cost of the slowest compression and the largest memory footprint, especially at high dictionary settings.
Head to head
| TAR.GZ | TAR.BZ2 | TAR.XZ | |
|---|---|---|---|
| Compress speed | Fast | Slow | Slowest |
| Decompress speed | Fast | Medium | Fast |
| Size | Largest | Small | Smallest |
| Memory | Low | Low | High |
| Ubiquity | Everywhere | Common | Common on Linux |
How to choose
- Distributing source code or backups to others? TAR.GZ. Anyone can open it in one second on any machine.
- Text-heavy archives where every megabyte counts and time does not? TAR.BZ2.
- Your own long-term archives, or releases where download size matters most? TAR.XZ.
You do not need the command line to make any of them. Pick your format and
create a TAR.GZ, TAR.BZ2 or TAR.XZ right in the
browser - and if a .tar.xz lands in your downloads, you can
extract it locally just as easily.