What is XZ?
Complete guide to the XZ file format
What is it?
XZ is a lossless data compression format using the LZMA2 algorithm, developed as part of the XZ Utils project in 2009. It provides excellent compression ratios that are competitive with 7-Zip's LZMA format, significantly outperforming both gzip and bzip2. XZ has become the preferred compression format for many Linux distributions including Fedora, Arch Linux, and Debian for distributing software packages, because the better compression ratios reduce download sizes for users.
The XZ format uses LZMA2 compression in a container designed for long-term data integrity, including CRC64 checksums for data verification. Compression is multi-threaded in modern implementations, which addresses the historical weakness of LZMA-based formats. Decompression is fast compared to compression - XZ decompresses at speeds comparable to bzip2 despite its much better compression ratio, making it practical for package distribution where files are compressed once and decompressed many times.
Technical Specifications
Pros & Cons
Advantages
Typically produces files 20 to 35% smaller than gzip and 10 to 20% smaller than bzip2 for the same input.
The default compression format for software packages on Arch Linux, Fedora, and many other distributions.
Built-in CRC64 checksums verify compressed data integrity, catching corruption before extraction.
Despite excellent compression, decompression speed is reasonable and competitive with bzip2.
Disadvantages
XZ compression is very slow compared to gzip, particularly at high compression levels, requiring minutes for large files.
Compression requires significant RAM - high compression levels can use 1 GB or more of memory.
Not as universally known among Windows users as ZIP or 7Z, though 7-Zip supports it fully.
The overhead of LZMA2 processing provides minimal benefit for small files where gzip is fast and adequate.
When to Use It
Here are the most common situations where XZ is the right choice:
Linux Package Distribution
The standard format for distributing compressed packages on Arch Linux (pacman uses .pkg.tar.xz) and many Fedora packages.
Source Code Archives
Many major open-source projects (Linux kernel, GNU packages) distribute source as .tar.xz for the best download size.
Large File Compression
Use xz when compressing large databases, log archives, or backup files where storage savings justify slower compression.
Long-Term Storage
The built-in integrity checking and high compression make xz a good choice for archival storage.
Convert Your Files Online - Free
Our free online converter supports all major formats. No software to install, no registration required.
Start Converting NowFrequently Asked Questions
Is XZ better than gzip?
XZ produces significantly smaller files (20 to 35% smaller for typical content) but is much slower to compress. Decompression speed is comparable. For software distribution where files are compressed once and downloaded many times, XZ is the better choice.
How do I decompress an XZ file?
Use: unxz filename.xz - or: xz -d filename.xz - For .tar.xz files: tar -xJf filename.tar.xz
Can I open XZ files on Windows?
Yes. 7-Zip fully supports .xz and .tar.xz files on Windows. WinRAR also supports XZ files.
Why is XZ compression so slow?
XZ uses the LZMA2 algorithm with large compression dictionaries that require analyzing large blocks of data for the best compression. This is computationally intensive. Use the -0 or -1 compression level flags for faster (though less efficient) compression.
What is the difference between XZ and 7Z?
7Z is a container format that can use LZMA/LZMA2 plus other algorithms, supports multiple files with directory structure, and features like AES encryption. XZ is a simpler single-stream LZMA2 format designed for Unix pipeline use. For multi-file archives with the best compression, 7Z is more feature-rich; for Unix/Linux use with TAR, XZ is the standard choice.