FormatDrop
Document Format

XZ

XZ Compressed File (LZMA2)

XZ is a lossless data compression format that uses the LZMA2 algorithm — the same compression engine as 7-Zip. Released in 2009 as a successor to lzma-utils, XZ achieves significantly better compression ratios than gzip and bzip2 at the cost of more CPU during compression. It's the default compression for kernel.org and many Linux distributions.

What is XZ?

XZ files contain a single file's data compressed with LZMA2 plus a small header and integrity check (CRC32 or SHA-256). Unlike ZIP or 7Z, XZ doesn't bundle multiple files — it's analogous to gzip in that one input file produces one .xz output. Multi-file archives use tar combined with XZ: .tar.xz.

XZ pros and cons

Advantages

  • Excellent compression ratio — typically 30–40% smaller than gzip
  • Built-in integrity check (CRC32 or SHA-256)
  • Free and open-source (LZMA2 algorithm)
  • Multi-threaded encoding/decoding
  • Universal Linux support — `xz` command bundled

Limitations

  • Slower compression than gzip (5–10× slower)
  • Higher memory usage during compression
  • Single-file compression — must combine with tar for archives
  • Less compatible than gzip on legacy systems
  • macOS doesn't include xz natively (requires Homebrew)

When should you convert XZ files?

Decompress XZ to access contents: `xz -d input.xz` (Unix) or use 7-Zip (Windows). Convert .tar.xz to .tar.gz for legacy compatibility: `xz -d archive.tar.xz && gzip archive.tar`. For maximum compression of distribution tarballs, .tar.xz is the modern standard.

All FormatDrop conversions run entirely in your browser — no file upload, no server processing. Your files stay on your device.

XZ FAQ

How do I decompress XZ on Windows?
Use 7-Zip (free): right-click the .xz file → 7-Zip → Extract here. PeaZip and WinRAR also support XZ. PowerShell with native XZ support is available via xz-utils for Windows.
What's the difference between .tar.xz and .tar.gz?
Both are tar archives compressed with different algorithms. .tar.xz uses LZMA2 (XZ) — better compression, slower. .tar.gz uses DEFLATE (gzip) — faster, larger files. Modern Linux distributions distribute kernels and packages as .tar.xz for size; older systems prefer .tar.gz for speed.
How do I create an XZ archive?
Single file: `xz input.txt` → produces input.txt.xz. Tar+XZ: `tar -cJf archive.tar.xz directory/` (J flag uses XZ). Maximum compression: `xz -9e input.txt` (level 9 with extreme flag — much slower but smaller).