What is XZ?

Discover what XZ files are, their functionality, and when to use them in this complete guide. Learn about the XZ format and its comparison to others.

Free online file converter tool. Works in Chrome Firefox Safari Edge Opera and other modern browsers on Windows macOS Linux Android and iOS. No software installation or sign-up required. All conversions run directly in your browser, so your files never leave your device. Free to use with no account needed.

XZ

What is XZ?

Complete guide to the XZ file format

Last updated:

Created2009
TypeArchive
Common UseMaximum compression

What is XZ?

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.

How XZ Works

An .xz file is produced by the XZ Utils compressor, and its appeal is a very high compression ratio. Like gzip and bzip2 it is a single-file stream compressor, not an archiver, so a directory is bundled first by tar to make a .tar.xz. What sets XZ apart is the algorithm underneath it: LZMA2, a refined version of the LZMA method made famous by the 7-Zip archiver.

LZMA is a dictionary compressor in the LZ77 family, but a very sophisticated one. It searches for repeated sequences using a large sliding window, often many megabytes, so it can find redundancy across long distances that gzip's small window would miss entirely. It then encodes the results with a range coder, a form of arithmetic coding that packs symbols even more tightly than the Huffman coding older formats use, and it adapts its statistical model as it goes.

The .xz container wraps this LZMA2 stream with a structured header and footer, integrity checks (it can use CRC-32, CRC-64, or SHA-256), and support for multiple independent blocks. Those blocks allow limited random access and multi-threaded compression, and the integrity fields make XZ suitable for long-term archives where silent corruption must be caught.

XZ offers presets from 0 to 9, with an extra e (extreme) modifier. Higher presets use a larger dictionary and search harder, producing smaller files but demanding substantially more time and memory, sometimes hundreds of megabytes of RAM at the top settings. Decompression, by contrast, is fast and light, which fits the compress-once, distribute-widely use case perfectly.

History and Standardization

XZ Utils grew out of the earlier LZMA SDK created by Igor Pavlov for 7-Zip. The .xz format and its command-line tools were developed to bring LZMA compression to the Unix world in a clean, streamable container, replacing an earlier and now deprecated format called .lzma.

The format is openly specified and the reference implementation is in the public domain, which made adoption frictionless. Linux distributions embraced it for package archives and kernel images because the smaller downloads meaningfully reduced mirror bandwidth, and it became a common choice for shipping source tarballs as .tar.xz.

Today XZ is a standard tool on essentially every Linux and BSD system and is supported by all major cross-platform archive utilities. It occupies the niche of maximum practical compression for distribution, where the extra encode time is paid once by the publisher and every downloader benefits from the smaller file.

XZ Compared to Gzip, Bzip2, and Zstandard

Against gzip and bzip2, XZ generally wins on size. It typically produces the smallest file of the three and, unlike bzip2, decompresses quickly. The cost is compression time and memory: building a high-preset .xz is slow and RAM-hungry, so XZ is best when the file is created once and read many times.

The modern trade-off is against Zstandard (zstd). At its highest levels zstd can approach XZ's ratio while compressing far faster, and it decompresses faster too. Where raw speed matters, zstd is often preferred; where the absolute smallest file is the goal and encode time is not a concern, XZ still tends to edge ahead. Many projects now offer both.

As with every stream compressor here, XZ is not an archiver. A lone .xz is one compressed file with no directory structure or permissions preserved, which is why it almost always appears as .tar.xz. That pairing, tar for structure and XZ for size, is a common default for Linux software distribution.

Technical Details

ProjectXZ Utils (Lasse Collin and others)[1]
File Extension.xz[1]
MIME Typeapplication/x-xz[1]
AlgorithmLZMA2 with CRC64 integrity checking[1]
Multi-threadingYes (pixz, xz --threads)[1]
Typical Compression vs gzip20 to 35% smaller files[1]
Toolsxz command, 7-Zip, WinRAR, most Linux package tools[1]

XZ vs Other Archive Formats

FeatureXZGZBZ27z
Compression algorithmLZMA2[1]DEFLATEBWTLZMA / LZMA2
Compression ratioVery high[3]ModerateHighVery high
SpeedSlowFastModerateSlow
Multiple filesSingle stream[2]Single streamSingle streamYes
Best forMax-ratio single streamsFast compressionBalanced ratioMulti-file archives

XZ delivers high compression on a single stream, trading speed for ratio compared with gzip.

Pros and Cons

Advantages

Excellent Compression Ratio

Typically produces files 20 to 35% smaller than gzip and 10 to 20% smaller than bzip2 for the same input.

Linux Distribution Standard

The default compression format for software packages on Arch Linux, Fedora, and many other distributions.

Data Integrity Checking

Built-in CRC64 checksums verify compressed data integrity, catching corruption before extraction.

Fast Decompression

Despite excellent compression, decompression speed is reasonable and competitive with bzip2.

Disadvantages

Slow Compression

XZ compression is very slow compared to gzip, particularly at high compression levels, requiring minutes for large files.

High Memory Usage

Compression requires significant RAM - high compression levels can use 1 GB or more of memory.

Less Common on Windows

Not as universally known among Windows users as ZIP or 7Z, though 7-Zip supports it fully.

Overkill for Small Files

The overhead of LZMA2 processing provides minimal benefit for small files where gzip is fast and adequate.

When to Use XZ

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 XZ Files

Need to convert your XZ files? Use our free online converter.

Try Archive Converter Free

How to open a XZ file

XZ files are compressed archives commonly used for distributing software and data. There are various software options available for handling XZ files, including professional tools, free and open-source programs, browser-based solutions, and built-in utilities in operating systems. Professional tools tend to offer advanced features and support, while free and open-source options are suitable for users who need basic functionality without cost. Browser-based tools provide convenience for quick access, while built-in utilities are often sufficient for casual users.

When choosing software for XZ files, several factors come into play, such as feature fidelity, whether the user needs to edit or simply view the content, and the cost model of the software. Platform compatibility is also crucial, as some tools may only be available on specific operating systems. Additionally, users should consider export needs and whether converting the XZ file to another format is more beneficial for their workflow.

7-Zip 21.07

Windows, macOS, LinuxFree (GPL)

7-Zip is a free and open-source file archiver that supports a wide range of formats, including XZ. It allows users to create, extract, and manage XZ files with high compression ratios and strong encryption options. The software maintains high fidelity when handling XZ files, ensuring that the original data is preserved during extraction.

Key features
  • Create and extract XZ archives
  • High compression ratio support
  • Strong AES-256 encryption
  • Command-line interface for automation
  • Integration with Windows Explorer
Strengths
  • Completely free and open-source
  • Excellent compression performance
  • Supports a wide range of formats
Limitations
  • User interface may feel outdated
  • Limited support for advanced editing

Exports to: ZIP, TAR, GZ, BZ2

Best for: 7-Zip is ideal for users seeking a powerful, free tool for managing XZ files with strong compression capabilities.

Visit 7-Zip →

WinRAR 6.20

Windows, macOS, LinuxFree trial / $29.00 (one-time purchase)

WinRAR is a popular file archiver that supports XZ files among many other formats. It provides a user-friendly interface and robust features for compressing and decompressing files. WinRAR maintains high fidelity during extraction and offers additional functionalities like file recovery and repair.

Key features
  • Create and extract XZ archives
  • File recovery and repair tools
  • Multi-volume archives support
  • Customizable compression settings
  • Integration with Windows context menu
Strengths
  • User-friendly interface
  • Strong recovery options
  • Widely recognized and trusted
Limitations
  • Paid software after trial period
  • Limited support for Linux users

Exports to: ZIP, TAR, GZ, RAR

Best for: WinRAR is suitable for users who prefer a polished interface and advanced features for handling XZ files, especially in a Windows environment.

Visit WinRAR →

PeaZip 9.2.0

Windows, LinuxFree (GPL)

PeaZip is a free and open-source file manager and archiver that supports XZ files. It offers a comprehensive set of features for creating and extracting archives, with a focus on security and usability. PeaZip ensures fidelity when dealing with XZ files and provides a modern interface.

Key features
  • Create and extract XZ archives
  • Secure file deletion options
  • Multi-platform support
  • Batch processing capabilities
  • Customizable user interface
Strengths
  • Cross-platform compatibility
  • Strong focus on security features
  • User-friendly modern interface
Limitations
  • Less known than competitors
  • Fewer advanced features than WinRAR

Exports to: ZIP, TAR, ARC, 7Z

Best for: PeaZip is perfect for users looking for a free, secure, and user-friendly tool for managing XZ files across multiple platforms.

Visit PeaZip →

The Unarchiver 4.3.1

macOSFree

The Unarchiver is a free macOS application designed to handle various archive formats, including XZ. It focuses on simplicity and ease of use, allowing users to quickly extract files from XZ archives without any complex settings. The Unarchiver maintains high fidelity during extraction, ensuring data integrity.

Key features
  • Extract XZ files effortlessly
  • Supports many archive formats
  • Integration with Finder
  • Automatic file association
  • Simple drag-and-drop functionality
Strengths
  • Extremely easy to use
  • Lightweight and fast
  • Seamless macOS integration
Limitations
  • Limited to extraction only
  • No advanced features for compression

Exports to: N/A

Best for: The Unarchiver is ideal for macOS users who need a straightforward tool for quickly extracting XZ files without additional complexities.

Visit The Unarchiver →

References

  1. XZ / LZMA compression - tukaani.org
  2. XZ Utils - tukaani.org
  3. XZ Utils - Wikipedia