Convert LZMA to TAR.BZ2 Online (Rebuilding a Legacy Stream Inside a Block-Sorted Tarball)

The old 13-byte LZMA_Alone header gets decompressed and rebuilt through bzip2's Burrows-Wheeler Transform inside a proper multi-file tar archive — a genuinely different compression pipeline, not just a new file extension.

  1. Add a file Choose or drop it here
  2. Pick the format Change it whenever needed
  3. Download the result After conversion completes

A 13-Byte Legacy Header Meeting Bzip2's Block-Sorted Compression

A .lzma file is the standalone container sometimes called LZMA_Alone: a 13-byte header — one byte packing the lc/lp/pb compression parameters, four bytes for dictionary size, eight bytes for uncompressed size — directly followed by LZMA-compressed data, with no magic number and nothing else wrapped around it. Igor Pavlov, who created the LZMA algorithm and built 7-Zip, placed the LZMA SDK in the public domain on December 2, 2008, and the .xz format that replaced this older standalone container arrived the following year, in 2009, specifically to fix problems this thinner format never addressed.

The specific documented reasons the standalone format lost favor by 2009 are worth naming directly, since they explain why so few tools bother writing new files in it today: it has no magic number for reliable detection, no checksum of any kind to catch corruption, and an ambiguous way of marking end-of-stream when the uncompressed size isn't known in advance, relying on an embedded marker that different decoders have handled inconsistently over the years.

TAR.BZ2 is a completely different kind of file: a plain tar archive, itself just a sequence of 512-byte header-and-data blocks recording each entry's name, permissions, and size, with the whole resulting stream then compressed using bzip2. Converting a .lzma file to .tar.bz2 means decompressing the legacy stream back to its original bytes, wrapping that recovered data in tar's own header structure, and running the result through bzip2's compression — a full pipeline, not a simple relabeling, since the two source formats don't share a container or a compression algorithm at any point.


Why LZMA and Bzip2 Compress Through Completely Different Pipelines

LZMA compresses through dictionary-based matching combined with range coding, an entropy-coding technique related to arithmetic coding that assigns fractional-bit-precision codes to symbols based on how often they occur, giving LZMA a compression ratio that generally beats older Lempel-Ziv-family algorithms on the same data. Bzip2, written by Julian Seward and first released in 1996, takes an entirely different route: it runs each block of input, up to 900 KB and selectable down to 100 KB in 100 KB steps via its -1 through -9 flags, through the Burrows-Wheeler Transform, which rearranges bytes to group similar sequences together, followed by move-to-front encoding and then Huffman coding.

Because bzip2 processes data in independent, fixed-size blocks rather than one continuous stream the way LZMA typically does, a bzip2 archive can sometimes recover the blocks that come after a single damaged one, a resilience property the legacy .lzma format's single unbroken stream doesn't share — though the legacy format's total lack of any checksum means damage often isn't even detected in the first place, whereas bzip2 at least fails visibly at the point where a corrupted block breaks its expected structure.

Licensing differs between the two as well, which matters for anyone redistributing tooling built around either one. Igor Pavlov placed the LZMA SDK in the public domain in December 2008, meaning it can be used and modified without any attribution or license obligation at all. Bzip2's own source code is distributed under a permissive BSD-style license carrying its own attribution and disclaimer conditions, a different but similarly unrestrictive arrangement that's part of why bzip2 ended up bundled into so much general-purpose software without licensing friction.


What Rebuilding an Old LZMA File as a Bzip2 Tarball Changes

  • Gain — native multi-file support: a single tar.bz2 archive can hold any number of files and folders; the legacy .lzma format holds exactly one compressed stream.
  • Lose — typically some compression efficiency: LZMA's range coding generally compresses somewhat more tightly than bzip2's Burrows-Wheeler-plus-Huffman approach on most kinds of data, so the resulting archive can end up larger for equivalent content.
  • Gain — Unix permissions and ownership: tar's own header blocks record file mode, owner, and group per entry, none of which the legacy format's 13-byte header tracks at all.
  • Gain — a fixed, checkable signature: bzip2 streams begin with the fixed "BZh" magic bytes followed by a block-size digit, letting tools confirm the format instantly, unlike the legacy format's complete absence of a magic number.
  • Lose — the old format's minimal overhead: tar's 512-byte header blocks plus bzip2's own block structure add more bytes of fixed overhead than the bare 13-byte legacy header ever carried, though this matters only on very small files.
  • Gain — partial fault tolerance from block independence: bzip2's per-block structure means later, undamaged blocks can sometimes still be recovered even if an earlier block is corrupted, unlike the single unbroken legacy LZMA stream.

Which Tools Actually Handle Both Ends of This Conversion

Decompressing the legacy .lzma file specifically requires a tool that still supports the old standalone format: XZ Utils via its `--format=lzma` option or its `lzma` command alias, 7-Zip's own GUI and command-line tool, or Python's `lzma` module using its `FORMAT_ALONE` constant. Building the tar.bz2 side is far more broadly supported: GNU tar handles both the archiving and, with its `-j` or `--bzip2` flag, the compression step in one command, and bzip2 itself ships by default on essentially every Linux distribution and on macOS.

On Windows, 7-Zip opens .tar.bz2 archives natively without any plugin, and the same 7-Zip installation that can decompress the source legacy .lzma file can also build the destination archive, making it the single most direct tool for this entire conversion end to end. WinRAR documents extraction support for tar.bz2-style archives as well, though it, like most consumer archive tools, has no documented support for the older standalone .lzma format specifically, meaning the decompression side of this conversion still needs a tool built with that legacy compatibility in mind.


Real, Documented Problems Converting Legacy LZMA Data to Bzip2

A recurring, documented issue involves the legacy .lzma file's uncompressed-size field being set to the unknown-size marker (0xFFFFFFFFFFFFFFFF), which relies on the decompressor correctly watching for an embedded end-of-payload signal instead of a fixed byte count — a tool that mishandles this ambiguous case can silently truncate the recovered data before it's ever wrapped in tar, producing a bzip2 tarball with an incomplete file inside it despite no error being reported anywhere in the process.

A second real complaint traces to memory demands during the compression step: bzip2's Burrows-Wheeler Transform needs noticeably more working memory per block than a simpler compressor would, and on very large recovered files or memory-constrained systems, this can make the bzip2 stage of the conversion measurably slower than the LZMA decompression step that preceded it, sometimes surprising users who expect uniform performance across a single conversion pipeline.

A third documented pattern involves confusing a raw .lzma file with a .tar.lzma file that was mislabeled during an earlier step — since the legacy format holds only one stream, feeding a genuinely single-file .lzma into a workflow that expects to unpack a multi-file tar archive from inside it produces just one file, not a directory tree, which is expected behavior given the format rather than a sign that anything went wrong.

A fourth issue shows up in scripted pipelines that assume any `.bz2`-suffixed output is automatically readable by every tool that claims general bzip2 support: a handful of older or minimal bzip2 implementations documented issues with very high compression levels (approaching the -9 setting's 900 KB block size) on memory-limited systems, producing a working archive on the machine that created it but a failure on a more constrained machine trying to extract it later, which is a real, if narrow, compatibility gap worth checking for in automated build systems specifically.


Legacy LZMA and TAR.BZ2 Compared Directly

Feature .LZMA (legacy standalone) TAR.BZ2 (tar + bzip2)
Core compression method Dictionary matching plus range coding Burrows-Wheeler Transform plus Huffman coding
Magic number None "BZh" plus block-size digit
Multi-file support No; single stream only Yes, via tar's own bundling
Block independence None; one continuous stream Yes, up to 900 KB blocks
Introduced Pre-2009, legacy status by then 1996 (bzip2)
Typical compression ratio Generally tighter Generally somewhat looser than LZMA
Source code license Public domain (LZMA SDK) Permissive BSD-style license

Questions About Rebuilding Legacy LZMA Data as a Bzip2 Tarball

Will the resulting tar.bz2 file be bigger or smaller than the original .lzma file?
Often somewhat bigger, since LZMA's range coding generally compresses more tightly than bzip2's Burrows-Wheeler-plus-Huffman approach on most data, though bzip2 still shrinks the data substantially compared with the uncompressed original.

Do LZMA and bzip2 use the same underlying algorithm?
No. LZMA combines dictionary-based matching with range coding, while bzip2 uses a completely different pipeline built around the Burrows-Wheeler Transform followed by Huffman coding — the two share no common compression stage.

Can a single .lzma file become a multi-file tar.bz2 archive?
Only if additional files are added during the tar step; the legacy .lzma format itself holds exactly one compressed stream, so the file it originally held becomes one entry in the new archive unless more files are bundled in alongside it.

Why does bzip2 sometimes recover from corruption better than the old .lzma file would?
Because bzip2 compresses in independent blocks, so damage to one block doesn't necessarily prevent reading the rest; the legacy .lzma format is one continuous stream with no checksum at all, so corruption there is both harder to detect and harder to work around.

What tool handles this entire conversion most directly?
7-Zip is the most direct single option, since it can both decompress the legacy standalone .lzma format and, combined with a bzip2-capable tar tool, build the resulting tar.bz2 archive.

Is bzip2 still worth using instead of the newer xz format LZMA was replaced by?
It depends on the priority: bzip2's block structure gives it some resilience against localized corruption that a single continuous xz stream doesn't automatically have, but xz using LZMA2 generally compresses tighter and faster overall on typical data, which is why xz, not bzip2, became LZMA's direct successor for general-purpose use.