iLoveConverter
Categories 11 categories
Archive TAR.BZ2

The TAR.BZ2 (.tar.bz2, .tbz2) Format, Explained

iLoveConverter Team 5 min read

On this page

TAR.BZ2 — written .tar.bz2 or .tbz2 — is a tar archive compressed with bzip2, the Burrows–Wheeler-based compressor that Julian Seward released in the late 1990s. For a decade it was the middle choice of the Unix compression trio: noticeably smaller than gzip, noticeably slower to open. In the 2.6 era, kernel.org distributed Linux source tarballs in this format before handing the role to .tar.xz around 2012. It still shows up in old source releases, backups and build scripts everywhere.

Two layers, two jobs

The name decomposes the same way as every tar stack:

  1. TAR — Tape ARchive. It concatenates files and directories into one byte stream with 512-byte headers carrying names, permissions, ownership and timestamps. TAR compresses nothing.
  2. BZ2 — bzip2. It compresses a single byte stream and knows nothing of files or folders.

tar builds the structure; bzip2 squeezes it. Strip the second layer with bzip2 -d and a plain .tar falls out.

Inside the bzip2 pipeline

bzip2 runs the input through a chain of classical algorithms, and each stage has one job:

  • Run-length encoding (RLE) — initial pass that collapses runs of identical bytes.
  • Burrows–Wheeler transform (BWT) — the heart. Input is processed in blocks (100 KB to 900 KB depending on the -1…-9 setting; -9 is the default), and each block is permuted so that identical contexts line up. Repeated text suddenly looks like long runs — easy prey for the next stages.
  • Move-to-front (MTF) — converts the permuted symbols into mostly small numbers.
  • Second RLE and Huffman coding — the small numbers are run-length coded and packed with multiple Huffman tables.

The stream layout is quirky and charming. Every stream starts with the letters BZh followed by the block-size digit — BZh9 for the default. Each block carries the 6-byte magic 0x314159265359 (the digits of π) and a CRC32; the stream ends with the marker 0x177245385090 (the digits of √π). Because each block is compressed independently, parallel decompressors such as pbzip2 and lbzip2 can chew through blocks concurrently — the one trick that softens bzip2’s famously slow decompression.

Technical parameters

ParameterValue
Extensions.tar.bz2, .tbz2 (also .tbz)
Containerbzip2 stream: BZh header, blocks, end marker
AlgorithmBWT + MTF + RLE + multi-table Huffman
Block size100 KB (-1) to 900 KB (-9, default)
Integrity checkCRC32 per block
ParallelismBlocks independent — pbzip2 / lbzip2 decompress in parallel
CompressionLossless
Recovery toolbzip2recover splits the stream into blocks
Typical homesLegacy source releases, kernel-era tarballs, old build pipelines

TAR.BZ2 next to its neighbors

AspectTAR.BZ2TAR.GZTAR.XZZIP
Compression ratioMiddleLowestBestLowest
Compression speedSlow (faster than xz)FastSlowestFast
Decompression speedSlowest of the threeFastFaster than bzip2Fast
Random accessNoneNoneStream indexCentral directory
Unix permissionsPreservedPreservedPreservedLimited
Native on WindowsNo toolNo toolNo toolYes

The ranking has not moved in twenty years: gzip for speed, bzip2 for ratio-when-gzip-is-not-enough, xz when ratio matters most. The painful spot for bzip2 is opening archives — its block-based decode is slower than both gzip and xz, which is exactly why kernel.org retired it in favor of xz: users extract kernels far more often than they build them.

Converting TAR.BZ2

Create and extract (Linux, macOS, and Windows 10+ tar):

tar -cjf archive.tar.bz2 folder/    # pack
tar -xjf archive.tar.bz2            # unpack
bzip2 -d archive.tar.bz2            # just the BZ2 layer, leaves a .tar

Speed up extraction on many-core machines with lbzip2 -d in place of bzip2 -d; the archive needs no repacking, since blocks are independent.

Repacking for sharing: when the archive must travel to Windows or the web, ZIP and 7Z handle compatibility better — see our 7Z to ZIP guide for the round trip between the two. The format’s own reference page is the TAR.BZ2 format guide, and its gzip-era sibling is documented at the GZ format guide.

Common problems

  • “bzip2: Data integrity error” — a block failed its CRC. Unlike gzip, bzip2 streams cannot resync after damage; bzip2recover can at least split undamaged blocks out of the file.
  • Extraction feels ancient — single-threaded bzip2 decode is the slowest of the trio. Use lbzip2 or pbzip2, or switch the archive to xz/gzip/zstd going forward.
  • “bzip2: (stdin) is not a bzip2 file” — the file is a plain TAR (or something else) wearing a .bz2 name; file archive.tar.bz2 settles it.
  • Windows cannot open it — Explorer handles neither layer; 7-Zip or PeaZip open it in two steps (BZ2 layer, then TAR).
  • Create fails on Windows’ default tools — classic tar supports -j on Windows 10+; older environments need 7-Zip or WSL.

FAQ

Is .tbz2 the same as .tar.bz2?

Yes. .tbz2 (and .tbz) are short aliases for .tar.bz2, dating back to the three-character-extension era.

Why was the Linux kernel distributed as .tar.bz2?

In the 2.6 era, kernel tarballs had outgrown gzip’s ratio but xz had not yet matured. bzip2 was the best available compromise, so kernel.org shipped .tar.bz2 as the preferred format until .tar.xz took over around 2012.

Does TAR.BZ2 compress better than TAR.XZ?

No — xz’s larger LZMA2 dictionary typically beats bzip2 by roughly 10% on text and source. bzip2 wins on one axis only: at its usual settings it compresses faster than xz.

Why is decompression so slow?

The Burrows–Wheeler inverse is inherently sequential and block-sized, and the Huffman stages add constant work per block. gzip’s DEFLATE and xz’s LZMA2 both decode faster — bzip2 trades open-time for its era’s ratio advantage.

Is TAR.BZ2 still worth using?

For new archives, no: xz beats its ratio and zstd beats its speed by large margins. Keep it for unpacking history — old source releases, old backups — and pick a modern format when you are the one compressing.

Try it yourself — free, right in your browser

Everything mentioned in this guide runs locally on this site: no upload, no watermark, no sign-up.

Format deep-dives: TAR.BZ2 (.tar.bz2.tbz2) , TAR (.tar) , ZIP (.zip) , GZ (.gz)