File Formats
  • Audio
  • Video
  • Images
  • 3D & CAD
  • Documents
  • Data
  • Code
  • System
Data
  • Structured text
  • Binary serialisation
  • Databases
  • Scientific
  • Geospatial
  • Machine learning
  • Messages & calendars
  • Compression
  • Archives
  1. Home
  2. Data
  3. Compression
  4. BZ2
.BZ2
  • Overview

.BZ2

Bzip2 compressed file

Introduction

Bzip2 compresses a single file. Julian Seward released it in 1996. It sorts each block of data with the Burrows–Wheeler transform, which groups similar text together, and then codes the result with move-to-front, run-length and Huffman coding. It compresses better than gzip but more slowly, and has largely given way to xz. A tar archive compressed with it is named .tar.bz2.

Software

  • bzip2 (macOS, Linux, Windows)
  • 7-Zip (Windows)
  • WinRAR (Windows)
  • PeaZip (Windows, macOS, Linux)

Structure

The file starts with BZh and a digit from 1 to 9 giving the block size in units of 100,000 bytes. After that the file is a stream of bits, not bytes: blocks start at any bit position.

  1. 0Header BZh and the block size digit4 bytes
  2. 4Blocks each starts with the 48-bit marker 31 41 59 26 53 59 and a CRCrepeated
  3. …End of stream the 48-bit marker 17 72 45 38 50 90 and a CRC of the whole file, padded to a whole byte80 bits
A bzip2 stream: header, blocks and end marker.

The block marker is the start of pi and the end marker is the start of the square root of pi, written in hexadecimal digits. Several bzip2 streams can be joined end to end, and the result decompresses as one file.

© 2026 fileformats.org About Contact Made by Lewpen