00

The short answer

  • Bzip2 is a lossless binary compression format that compresses a single file rather than packaging a directory or multiple named entries.
  • Use bunzip2 or bzip2 -d to decompress a BZ2 file, or bzcat to write its contents to standard output. A libarchive-compatible application can also process the format. The official decoder supports concatenated bzip2 streams. Remember that a BZ2 stream normally contains one compressed file, not a browsable multi-file archive.
  • Bzip2 provides no encryption, and the compressed stream is not intrinsically executable. Its decoded payload can nevertheless contain arbitrary content, so assess that content before opening or executing it. Use bounded processing for untrusted files because decoded data can be much larger and the header-selected block size determines decompression memory demand.
01

Bzip2 Compressed Data (.BZ2, .BZIP2)

Created by Julian Seward, Bzip2 uses Burrows–Wheeler block sorting and Huffman coding. A stream begins with a four-byte header, contains independently compressed blocks, and ends with a marker carrying a 32-bit CRC for the complete uncompressed stream. Block sizes range from 100,000 to 900,000 bytes and are recorded in the header.

Keep the original

To convert BZ2 to another compression format, first decompress it and then apply the destination compressor. A lossless destination compressor can preserve the payload, but not the original bzip2 representation, block size, compressed blocks, or CRC layout.

02

How to open it

Use bunzip2 or bzip2 -d to decompress a BZ2 file, or bzcat to write its contents to standard output. A libarchive-compatible application can also process the format. The official decoder supports concatenated bzip2 streams. Remember that a BZ2 stream normally contains one compressed file, not a browsable multi-file archive.

I only want to read it

Use bunzip2 or bzip2 -d to decompress a BZ2 file, or bzcat to write its contents to standard output. A libarchive-compatible application can also process the format. The official decoder supports concatenated bzip2 streams. Remember that a BZ2 stream normally contains one compressed file, not a browsable multi-file archive.

I need to send it to someone

To convert BZ2 to another compression format, first decompress it and then apply the destination compressor. A lossless destination compressor can preserve the payload, but not the original bzip2 representation, block size, compressed blocks, or CRC layout.

03

File safety

Bzip2 provides no encryption, and the compressed stream is not intrinsically executable. Its decoded payload can nevertheless contain arbitrary content, so assess that content before opening or executing it. Use bounded processing for untrusted files because decoded data can be much larger and the header-selected block size determines decompression memory demand.

Stop if any of this looks off

An unknown sender, a name ending in two extensions, or contents that do not match the extension — check before you open it.

04

Converting it

To convert BZ2 to another compression format, first decompress it and then apply the destination compressor. A lossless destination compressor can preserve the payload, but not the original bzip2 representation, block size, compressed blocks, or CRC layout.

Before you convert

Convert a copy, never the original, then compare quality, metadata, and layout against what you started with.

05

Common questions

What is a BZ2 file used for?

A BZ2 file is a lossless binary Bzip2 stream used to compress one file. Unlike a multi-entry archive, it does not package a directory or several named files by itself.

How do I open a BZIP2 compressed file?

Run bunzip2 or bzip2 -d to decompress it, use bzcat to send the decoded content to standard output, or choose a libarchive-compatible application.

How do I open a BZ2 file on Windows?

Use a Windows build of bunzip2 or bzip2 -d, or a libarchive-compatible application. After decompression, open the resulting payload with an application suitable for its actual file type.

How do I open a BZ2 file on Mac?

In a terminal, run bunzip2 or bzip2 -d on the file, or use bzcat when you want the decoded bytes on standard output. A libarchive-compatible application is another option.

How do I open a BZ2 file on a phone?

Mobile apps differ in what they can decompress, so check an app's stated format list for BZ2 or Bzip2 support before installing it.

How can I recover a damaged BZ2 file that fails a CRC check?

CRC failure reports corruption but cannot reconstruct the original data. The official bzip2recover utility can attempt block-level recovery, so any recovered output should still be checked carefully.

Should I use BZIP2 or ZIP for several named files?

Use Bzip2 when compressing a single file. Bzip2 does not package a directory or multiple named entries, so a multi-entry archive format is the appropriate structural choice for that requirement.

How do I convert a BZIP2 file to ZIP without changing its payload?

Decompress the BZIP2 stream and then compress the resulting payload with the destination format. This can preserve the payload when both stages are lossless, but it will not preserve Bzip2 blocks, block size, or CRC layout.

Is a BZIP2 file safe to open?

The Bzip2 stream is not intrinsically executable and provides no encryption, but decompression may expose arbitrary content. Assess the decoded file separately and limit memory and output consumption for untrusted input.

What is the BZ2 file header magic BZh?

PRONOM identifies the start pattern as 42 5A 68 ?? 31 41 59 26 53 59: ASCII BZh, a block-size byte, and the first block marker. A matching pattern identifies the format but does not establish that the content is trustworthy.

Why does BZIP2 decompression return BZ_MEM_ERROR?

Decompression memory depends on the block size recorded in the input header. BZ_MEM_ERROR can occur when insufficient memory is available; process untrusted streams with explicit resource bounds because output may also expand substantially.

06

Related formats

Sources

bzip2 and libbzip2, version 1.0.8 — Official Manual · Official bzip2 project documentation

PRONOM: BZIP2 Compressed Archive (x-fmt/268) · The National Archives, UK format registry

PRONOM: BZIP2 Compressed Archive Signatures · The National Archives, UK signature registry

Sustainability of Digital Formats: bzip2 · Library of Congress

LibarchiveFormats · Official libarchive project documentation