Cookies for analytics and advertising
We use cookies for analytics and advertising, both sent to Google. Refusing changes nothing you can see.Read the privacy page
Converting TAR to BZ2 compresses a tarball with bzip2, which sorts blocks of up to 900 KB rather than looking back 32 KB the way gzip does. That buys a modest reduction on text and costs real time at both ends. The registry marks BZ2 legacy, so this page is written for the reader whose destination names `.tar.bz2` specifically — if nothing does, gzip or XZ is the better answer.
Up to 100 files at once. Mixed formats are fine.
They convert one after another and download together as a ZIP.
TAR to BZ2
Almost everyone arriving here was told to. A package recipe lists `.tar.bz2` in its sources and computes a hash against it. A project’s release process has produced that extension since 2006 and the download page, the mirrors and the third-party build scripts all point at it. A university or government deposit specifies the format in a submission checklist. An old distribution’s upload tooling accepts it and nothing newer.
None of those are going to change for one archive, and none of them are wrong to resist changing — an artefact name is part of a contract that other people have built against. That makes this a compliance conversion, and it deserves to be framed as one rather than dressed up as an optimisation. If you are choosing freely and nothing downstream cares, the honest recommendation on this page is to close it and pick gzip for speed or XZ for size.
Bzip2, from 1996, does something structurally different from both of its neighbours. It cuts the input into blocks of up to 900 KB and applies a Burrows–Wheeler transform to each one, which reorders the bytes so that identical contexts end up adjacent. A move-to-front pass and Huffman coding then squeeze the resulting runs. It is not a sliding-window compressor at all.
The registry records the 900 KB block as its window, and that number is the fair comparison against gzip’s 32 KB: within a block, bzip2 sees far more context than gzip ever can, which is why it wins on text. It is also the fair comparison against XZ’s 64 MB dictionary, which is where bzip2 loses — a 900 KB block cannot notice that a file at the start of the archive resembles one at the end. Bzip2 sits precisely between them, and being in the middle is why it has been squeezed out.
Compression is slow because the sort is expensive, and that is the part you pay for once, on a machine that is not waiting for you. It is bearable. Decompression is the surprise: undoing a block sort is real work, unlike undoing a sliding-window match, so bzip2 is far slower to unpack than gzip and slower than xz too.
This is what makes the format a poor choice for anything fetched and unpacked repeatedly. A dependency downloaded on every CI run, a container layer, an artefact pulled by a hundred machines — every one of them pays the decompression cost every time, and it is measured in minutes on a large archive rather than seconds. Bzip2 is tolerable for something written once and read once. It is genuinely expensive for something written once and read continually.
Memory at decompression. Bzip2 works in blocks of at most 900 KB, so the buffer it needs to unpack anything is small and fixed no matter how large the archive is. XZ needs memory scaled to the dictionary the file was written with, which the registry records at up to 64 MB — and if the machine cannot provide it, the archive does not open at all.
That matters in a narrower set of places than it used to, but the places are real: routers and embedded appliances, memory-capped containers, recovery environments, an initramfs, an old system nobody is allowed to upgrade. If the archive has to be unpacked somewhere like that, bzip2 is a defensible engineering choice rather than a legacy habit, and it is worth writing down why in the release notes so the next person does not "fix" it.
BZ2 compresses exactly one stream. It has no field for a file name, no notion of a directory and no way to mark where one member ends and the next begins — the registry lists the absence of directory structure as a known problem for the format. Everything a listing of a `.tar.bz2` shows you is being read out of the TAR inside it.
So the conversion unpacks whatever you sent, writes a fresh TAR from the contents, and compresses that with bzip2. The tarball is built from inside the extracted directory, so your files sit at the top level rather than inside a wrapper folder. The download arrives with a `.bz2` extension and should be renamed to `.tar.bz2`, which is both accurate and the form that lets `tar xjf` do the whole job in one command.
Bzip2’s blocks are compressed independently of each other, which gives the format a property its neighbours do not have: damage to one block does not necessarily destroy everything after it. Tools exist that walk a corrupted bzip2 file, find the intact block boundaries and recover what is still readable.
Treat that as a consolation rather than a strategy. The TAR inside is a continuous stream of headers and data, so recovering some blocks and not others gives you a tarball with holes in it, and whether that yields usable files depends entirely on where the damage fell. If surviving bit rot is an actual requirement, the answer is a format with per-member checksums and separate parity, not a compressor with a helpful failure mode.
The conversion does not wrap bzip2 around the file you uploaded. It extracts the TAR and writes a new one, then compresses that. The files inside are byte for byte identical — this is a lossless repack — but the archive around them is new, and member ordering, recorded timestamps and permission bits may differ from what you sent.
For the packaging reader that is the detail that decides whether this tool is the right one. If the recipe checks a hash of the artefact, the artefact has to be produced deterministically on a machine you control, with `tar --sort=name --mtime=…` and `bzip2` doing the work. Use this converter when you need a `.tar.bz2` to exist — for a mirror, a colleague, an upload form, a test — and not when the exact bytes are part of the contract.
On our server, not in your browser. Many tools on this site convert on your own device and say so; archive work is one of the exceptions, because it needs real programs. The file goes over an encrypted connection to a container running 7-Zip and bzip2, and that container has no outbound internet access of its own.
Every job gets a scratch directory on a memory-backed filesystem which is thrown away as soon as the job ends, successful or not, and any job still running after sixty seconds is killed. That timeout is more likely to be reached here than on most pairs, because bzip2 compression is slow — a large tarball of text is exactly the input that takes its time. The free tier accepts 25 MB per uploaded file.
The only honest ratio figure is the one measured on your data, and getting it takes two minutes: compress the same TAR as GZ, as BZ2 and as XZ and put the three sizes side by side. On a source tree or a set of logs the ordering will be predictable — XZ smallest, BZ2 next, GZ largest — but the gaps vary enormously with the contents, and on a tarball of already-compressed files all three land within a rounding error of each other.
Then weigh the numbers you cannot see in a file listing. How often will this be unpacked, and by what? Gzip if the answer is "constantly, by machines". XZ if the answer is "almost never, by a normal computer". BZ2 if something specified it, or if the machine at the far end has very little memory. Choosing bzip2 for its compression ratio alone is a decision that made sense twenty years ago and has quietly stopped being true.
| TAR | BZ2 | |
|---|---|---|
| Full name | Tape Archive | Bzip2 Archive |
| File extension | .tar | .bz2 |
| Media type | application/x-tar | application/x-bzip2 |
| Compression | Uncompressed | Lossless — nothing is discarded |
| First published | 1979 | 1996 |
| Specification | POSIX.1-2001 ustar | — |
| Licensing | Open standard | Open standard |
| Standing today | Current | Legacy, still read everywhere |
| Opens in a browser | No browser | No browser |
| Considered instead | ZIP, GZ | GZ, XZ |
Nothing is discarded. TAR and BZ2 both store their content losslessly, so the conversion is a change of packaging rather than a change of quality, and it can be repeated without accumulating damage.
BZ2 compresses a single stream and cannot hold a directory. That is precisely why BZ2 is normally paired with an archive format — the archive collects the files, BZ2 compresses the result.
7-Zip and Keka read both TAR and BZ2, so there is a way to check the result against the original without a second tool.
BZ2 packs the same samples into roughly half the space. Nothing is discarded — decode it and you get the TAR back bit for bit — which makes it the better shelf for anything you intend to keep.
TAR was published in 1979. The specification is POSIX.1-2001 ustar, and it is worth reading if the file has to outlive the tool that wrote it.
BZ2 dates from 1996. bzip2, 7-Zip and Keka all read it.
TAR was published in 1979 and BZ2 in 1996. The older one is generally the safer file to hand to somebody; the newer one usually does the job in fewer bytes.
Yes — this conversion needs software that cannot run in a browser, so the file is uploaded over an encrypted connection. It is deleted as soon as the job finishes, and the result is sent straight back to you without being stored. The work is done by 7-Zip, the archiver, in its command-line form.
Rarely. The registry marks BZ2 as legacy, and on most text XZ compresses better and decompresses faster while gzip decompresses far faster still. Bzip2 sits in the middle and wins on neither axis. It remains a correct choice when something downstream names it, and when the machine unpacking it has very little memory.
Usually somewhat smaller on text, because bzip2 sorts blocks of up to 900 KB where gzip looks back only 32 KB. The gap is real but modest, and it is paid for in speed at both ends. On a tarball of images or video there is no meaningful difference, because neither compressor can find redundancy that the file formats already removed.
Because of how it gets its ratio. Bzip2 applies a Burrows–Wheeler transform to each block, which has to be undone at decompression, and that inverse is genuinely expensive work. Gzip decompression is close to the speed of a memory copy; bzip2 is nothing like it, and on a large archive the difference is minutes rather than seconds.
Yes, in the TAR inside it. BZ2 compresses one stream and has no field for a name or a directory, so the members are collected into a TAR first — that is what `.tar.bz2` means. The download ends `.bz2`; rename it to `.tar.bz2` so `tar xjf` handles both layers at once.
Do not assume so. The TAR is rebuilt from the extracted contents rather than compressed as you sent it, so member order, timestamps and permission bits can differ, and any published checksum will not match. If reproducibility is the requirement, build the archive on your own machine where you control every input.
25 MB per file on the free tier, because this pair runs on our server rather than in your browser. A TAR is uncompressed, so that ceiling arrives sooner here than it does on a pair whose source is already compressed.