What is BZ2 (Bzip2)?
Complete guide to the BZ2 file format
What is it?
BZ2 is the file extension for files compressed with bzip2, a free and open-source data compression program created by Julian Seward in 1996. Bzip2 uses the Burrows-Wheeler block-sorting algorithm combined with Huffman coding to achieve better compression ratios than gzip, typically producing files 10 to 15% smaller at the cost of significantly slower compression and decompression speed. The .bz2 extension indicates a single compressed file; for directories, bzip2 is combined with tar to create .tar.bz2 archives.
Bzip2 works by rearranging the bytes in a block of data (using the Burrows-Wheeler transform) to produce sequences that compress well with Huffman coding. This block-sorting approach is particularly effective on text files, source code, and repetitive binary data. Bzip2 has been widely used in Linux software distribution - many open-source projects distributed source code as .tar.bz2 archives from the late 1990s through the 2000s, before .tar.xz became the preferred alternative for even better compression.
Technical Specifications
Pros & Cons
Advantages
Consistently produces 10 to 15% smaller files than gzip on text and source code, saving significant space for large packages.
Installed by default on virtually all Linux and Unix systems with no additional software needed.
The Burrows-Wheeler transform is particularly effective on text, XML, source code, and other structured data.
Pbzip2 and lbzip2 provide parallel multi-threaded bzip2 compression for much faster processing on multi-core systems.
Disadvantages
Compression is typically 3 to 4 times slower than gzip, and decompression is about 2 times slower.
XZ (LZMA2) offers better compression than bzip2 and is becoming the preferred format for Linux packages.
Poor performance for streaming applications because the block-sorting process requires buffering large blocks of data.
Cannot extract a file from the middle of a .tar.bz2 archive without processing preceding data.
When to Use It
Here are the most common situations where BZ2 (Bzip2) is the right choice:
Linux Software Packages
Download and install software distributed as .tar.bz2 source archives for compilation on Linux systems.
Space-Critical Archiving
Use bzip2 compression when storage space is more important than compression or decompression speed.
Legacy Package Management
Encounter .tar.bz2 files when working with older open-source software archives from the early 2000s.
Data Archiving
Archive large collections of text documents or source code where better compression ratios justify slower processing.
Convert Your Files Online - Free
Our free online converter supports all major formats. No software to install, no registration required.
Start Converting NowFrequently Asked Questions
Is bzip2 better than gzip?
In terms of compression ratio, bzip2 is 10 to 15% better than gzip. However, bzip2 is 3 to 4 times slower to compress and about 2 times slower to decompress. For most uses, xz offers even better compression than bzip2 with better decompression speed.
How do I decompress a .bz2 file?
Use: bunzip2 filename.bz2 - or: bzip2 -d filename.bz2 - For .tar.bz2 files: tar -xjf filename.tar.bz2
Can I open BZ2 files on Windows?
Yes. 7-Zip and WinRAR can extract .bz2 and .tar.bz2 files on Windows without any issues.
Why do some downloads use .tar.bz2 instead of .tar.gz?
Older Linux packages used .tar.bz2 because it offered better compression than .tar.gz. Modern packages increasingly prefer .tar.xz for even better compression ratios.
How do I create a .tar.bz2 archive?
Use: tar -cjf archive.tar.bz2 directory/ - The -j flag specifies bzip2 compression.