What is the BZ file format?
A .bz file is a bzip2-compressed data file - functionally identical to the more common .bz2 format. The same compression algorithm, the same binary stream structure, and the same tooling apply; .bz is simply the older, shorter extension convention for bzip2 output. All software that handles .bz2 handles .bz equally.
bzip2 compresses a single data stream using a Burrows-Wheeler transform (BWT), followed by move-to-front encoding, run-length encoding, and Huffman coding. This multi-stage pipeline typically achieves better compression ratios than .gz on text and source code, at the cost of slower compression and decompression speed.
The file begins with a 3-byte signature BZh (hex 42 5A 68) followed by an ASCII digit 1-9 indicating the block size in hundreds of kilobytes (9 = 900 KB default). Each compressed block contains an independent CRC-32 checksum; the file ends with a stream-level CRC-32, allowing bzip2recover to salvage undamaged blocks from a partially corrupt file.
Like gzip, bzip2 compresses a single file stream with no multi-file bundling. To compress a directory, wrap files in a .tar archive first, producing .tar.bz2 (also .tbz2).
- bzip2 was created by Julian Seward; version 1.0.8 (2019) is the current stable release.
- The format is increasingly displaced by xz/LZMA and zstd for better compression ratio or speed.
- The
bunzip2command and thetar -jflag decompress.bzand.bz2files.
Security & safety
RISK: LOWbzip2 is open-source and the format is safe; a .bz cannot execute on its own. Standard archive cautions apply: a .bz from an untrusted source may contain a malicious executable revealed after extraction - scan contents before running anything. A tiny .bz can expand to a very large file (decompression bomb), so be wary of unusually small archives.
Format details
in a nutshellPrograms that open BZ files
Technical details
deep spec| File signature | 42 5A 68 ("BZh") at offset 0, followed by ASCII digit 1-9 (block size: n × 100 KB) |
| Compression algorithm | Burrows-Wheeler transform (BWT) + move-to-front + run-length encoding + Huffman coding |
| Block size | 100 KB - 900 KB (set at compression time via -1 through -9 flags; -9 = 900 KB default) |
| CRC integrity | CRC-32 per compressed block + stream-level CRC-32 footer |
| Container | None - single compressed stream; does not bundle multiple files |
| MIME type | application/x-bzip (also application/x-bzip2) |
| Encoding | Binary bit-stream; no byte-order alignment required |
| Partial recovery | bzip2recover extracts undamaged blocks from a corrupt or truncated file |
| Multi-file use | Combine with .tar to produce .tar.bz2 (.tbz2) for multi-file compression |
| Compression ratio vs gzip | Typically 10-20% better on text/source code; significantly slower compression and decompression |
| Typical decompression speed | ~20-30 MB/s single-core (much slower than zstd or lz4) |
| Format stability | Unchanged since bzip2 1.0 (2000); all BZh streams across versions are mutually compatible |
| Legacy variant | BZ0 (bzip pre-1.0) used arithmetic coding - obsolete, not readable by bzip2 1.x |
| Modern alternatives | xz/LZMA for better compression ratio; zstd for better speed; both gradually displacing bzip2 |
| Released | 1996 (bzip 0.21); bzip2 1.0 in 2000 |
| Latest version | bzip2 1.0.8 (2019); format unchanged since 1.0 |
| Open standard | Yes · royalty-free |
| Specification | sourceware.org |
BZ conversions
Community Q&A
asked by usersNo questions yet - be the first to ask about BZ files.