The TAR.XZ (.tar.xz, .txz) Format, Explained
iLoveConverter Team 5 min read
On this page
TAR.XZ — written .tar.xz or .txz — is a tar archive squeezed through XZ, the highest-ratio compressor of the classic Unix trio (gzip, bzip2, xz). It is the format Linux kernel source tarballs ship in, the package payload of several distributions, and the default answer when disk space or download size matters more than compression time.
Two layers, two jobs
As with every tar-plus-compressor stack, the name tells you the architecture:
- TAR — Tape ARchive. It concatenates files and directories into one byte stream, recording names, permissions, ownership and timestamps in 512-byte headers. TAR compresses nothing.
- XZ — the container and stream format around LZMA2, the modernized LZMA algorithm that grew out of Igor Pavlov’s LZMA SDK and became the XZ Utils project around 2008. XZ compresses a single byte stream; it has no concept of files.
So tar builds the structure and xz squeezes it. You can verify the layering yourself: run xz -d on a .tar.xz and a plain .tar falls out.
What is inside an XZ stream
The XZ format is more structured than gzip’s single-block design:
- Stream header — starts with the magic bytes
FD 37 7A 58 5A 00, followed by stream flags and a CRC of the header. - Blocks — the payload is divided into blocks, each independently decodable from its own block header. A block can carry an optional BCJ filter (x86, ARM and friends) that reorders executable code so it compresses better.
- Integrity check — every block ends with a checksum: CRC32, CRC64 (the default) or SHA-256.
- Index and stream footer — the index records block offsets for seeking, and the stream closes with the
YZmagic. Multiple streams may be concatenated into one file.
LZMA2 itself works on large dictionaries — up to 64 MiB — which is where its ratio advantage comes from: it can exploit repetition across an entire tar stream, not just within a 900 KB window. The cost is memory and, above all, time.
Technical parameters
| Parameter | Value |
|---|---|
| Extensions | .tar.xz, .txz |
| Container | XZ stream: header, blocks, index, footer |
| Algorithm | LZMA2 (LZMA-class dictionary coder) |
| Presets | 0–9; default -6 (8 MiB dictionary), -9e uses 64 MiB |
| Integrity check | CRC32 / CRC64 (default) / SHA-256, none |
| Extra filters | BCJ filters for executable machine code |
| Parallelism | Multi-threaded compression (xz -T0), multi-stream |
| Compression | Lossless |
| Typical homes | Kernel source tarballs, distribution packages, source releases |
TAR.XZ next to its neighbors
| Aspect | TAR.XZ | TAR.GZ | TAR.BZ2 | 7Z | ZIP |
|---|---|---|---|---|---|
| Compression ratio | Best of the three tar stacks | Lowest | Middle | Comparable, solid mode | Lowest |
| Compression speed | Slowest | Fast | Slow | Configurable | Fast |
| Decompression speed | Faster than bzip2 | Fast | Slowest | Fast | Fast |
| Random access | Index per stream | None | None | Good | Central directory |
| Unix permissions | Preserved | Preserved | Preserved | Preserved | Limited |
| Native on Windows | No tool | No tool | No tool | No tool | Yes |
The honest summary: among gzip, bzip2 and xz, xz wins on ratio, loses on compression time, and beats bzip2 on decompression. That trade-off is why kernel.org switched its source tarballs to .tar.xz around 2012 — users download megabytes less and only pay once on extract. Distribution packages made the same choice for the same reason (Arch Linux carried .pkg.tar.xz for years before moving to zstd, and Slackware still uses .txz).
Converting TAR.XZ
Create and extract (Linux, macOS, and Windows 10+ tar):
tar -cJf archive.tar.xz folder/ # pack
tar -xJf archive.tar.xz # unpack
xz -d archive.tar.xz # just the XZ layer, leaves a .tar
Tune with presets when the wait matters: xz -1 compresses quickly with a weaker ratio, xz -9e --check=sha256 squeezes hardest and takes its time.
For cross-platform sharing, ZIP and 7Z are friendlier — Windows opens ZIP natively, and 7Z compresses as hard as XZ with solid archiving on top. Our ZIP to 7Z converter repacks an archive into 7Z entirely in your browser — files never leave the device, no upload — and the 7Z to ZIP guide covers the reverse trip when compatibility matters more than bytes. The format’s own reference page is the TAR.XZ format guide.
Common problems
- “xz: File format not recognized” — the file is not actually an XZ stream. Plain TAR renamed to
.tar.xzis a classic;file archive.tar.xztells the truth. - Compression takes forever on a huge tree — drop the preset (
xz -3), enable threads (-T0), or choose zstd instead when ratio matters less than time. - Memory errors on small machines — dictionary size drives decompression memory;
-6is already demanding for embedded boards,-9more so. - One damaged byte kills the rest — like every whole-stream format, XZ cannot resync after corruption. Keep checksums for anything long-lived.
- Windows cannot open it — Explorer does not handle
.tar.xz; 7-Zip or PeaZip do, in two steps (XZ layer, then TAR).
FAQ
Is .txz the same as .tar.xz?
Yes. .txz is a short alias for .tar.xz, used by Slackware packages and old tools built for three-character extensions.
Does TAR.XZ compress better than ZIP?
Usually yes — on text and source trees, XZ’s large dictionary typically beats ZIP’s DEFLATE by a wide margin (often 20–30%). On already-compressed content such as JPG or MP4, all of them compress roughly 0%.
Why is compressing so slow?
LZMA2 runs match-finding searches over a dictionary of many megabytes. That search is the ratio — and the time. Lower presets trade ratio for speed directly.
Can TAR.XZ hold Unix permissions?
Yes. Permissions, ownership and timestamps live in the TAR layer and survive extraction, which is why it remains the packaging format of source code.
Is TAR.XZ safe to stream over a pipe?
Yes — XZ compresses and decompresses sequentially, so tar -cJ pipelines work without intermediate files. Seeking, however, still requires reading from the start.
Try it yourself — free, right in your browser
Everything mentioned in this guide runs locally on this site: no upload, no watermark, no sign-up.
Format deep-dives: TAR.XZ (.tar.xz.txz) , TAR (.tar) , ZIP (.zip) , 7Z (.7z)