XZ 是什么?XZ 格式完整指南

了解XZ文件的功能及使用场景,全面指南涵盖XZ格式及比较。

免费在线文件转换工具。在 Windows、macOS、Linux、Android 和 iOS 上的 Chrome、Firefox、Safari、Edge、Opera 及其他现代浏览器中运行。无需安装软件或注册。所有转换都直接在您的浏览器中进行,因此您的文件不会离开您的设备。免费使用,无需账户。

XZ

XZ 是什么?XZ 格式完整指南

XZ 文件的完整指南 - 技术细节、优缺点、使用案例和常见问题

最后更新:

Year2009
TypeArchive
UsageMaximum compression

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

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

Pros & Cons

Advantages

优秀的压缩比

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

Linux 发行版标准

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.

在Windows上不常见

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软件包分发

The standard format for distributing compressed packages on Arch Linux (pacman uses.pkg.tar.xz) and many Fedora packages.

源代码归档

Many major open-source projects (Linux kernel, GNU packages) distribute source as.tar.xz for the best download size.

大文件压缩

Use xz when compressing large databases, log archives, or backup files where storage savings justify slower compression.

长期存储

The built-in integrity checking and high compression make xz a good choice for archival storage.

如何打开 XZ 文件

XZ 文件是常用于分发软件和数据的压缩档案。处理 XZ 文件的软件选项有多种,包括专业工具、免费和开源程序、基于浏览器的解决方案和操作系统中的内置实用程序。专业工具往往提供高级功能和支持,而免费和开源选项适合需要基本功能而不花费的用户。基于浏览器的工具提供了快速访问的便利,而内置实用程序通常足以满足休闲用户的需求。

在选择处理 XZ 文件的软件时,多个因素会影响决策,例如功能保真度、用户是否需要编辑或仅查看内容,以及软件的成本模型。平台兼容性也至关重要,因为某些工具可能仅在特定操作系统上可用。此外,用户还应考虑导出需求,以及将 XZ 文件转换为其他格式是否对他们的工作流程更有利。

7-Zip 21.07

Windows, macOS, Linux免费(GPL)

7-Zip 是一款免费的开源文件归档工具,支持多种格式,包括 XZ。它允许用户创建、提取和管理 XZ 文件,具有高压缩比和强大的加密选项。该软件在处理 XZ 文件时保持高保真度,确保在提取过程中保留原始数据。

主要功能
  • 创建和提取 XZ 档案
  • 高压缩比支持
  • 强大的 AES-256 加密
  • 用于自动化的命令行界面
  • 与 Windows 资源管理器集成
优点
  • 完全免费和开源
  • 出色的压缩性能
  • 支持多种格式
局限
  • 用户界面可能显得过时
  • 对高级编辑支持有限

可导出为: ZIP, TAR, GZ, BZ2

适合: 7-Zip 非常适合寻求强大、免费的工具来管理 XZ 文件,具有强大的压缩能力。

访问 7-Zip →

WinRAR 6.20

Windows, macOS, Linux免费试用 / $29.00(一次性购买)

WinRAR 是一款流行的文件归档工具,支持 XZ 文件以及许多其他格式。它提供用户友好的界面和强大的压缩和解压缩功能。WinRAR 在提取过程中保持高保真度,并提供额外的功能,如文件恢复和修复。

主要功能
  • 创建和提取 XZ 档案
  • 文件恢复和修复工具
  • 支持多卷档案
  • 可定制的压缩设置
  • 与 Windows 上下文菜单集成
优点
  • 用户友好的界面
  • 强大的恢复选项
  • 广泛认可和信任
局限
  • 试用期后需付费
  • 对 Linux 用户支持有限

可导出为: ZIP, TAR, GZ, RAR

适合: WinRAR 适合喜欢精致界面和高级功能的用户,尤其是在 Windows 环境中处理 XZ 文件。

访问 WinRAR →

PeaZip 9.2.0

Windows, Linux免费(GPL)

PeaZip 是一款免费的开源文件管理器和归档工具,支持 XZ 文件。它提供了一整套创建和提取档案的功能,专注于安全性和可用性。PeaZip 在处理 XZ 文件时确保保真度,并提供现代化的界面。

主要功能
  • 创建和提取 XZ 档案
  • 安全文件删除选项
  • 多平台支持
  • 批处理能力
  • 可定制的用户界面
优点
  • 跨平台兼容性
  • 强烈关注安全功能
  • 用户友好的现代界面
局限
  • 不如竞争对手知名
  • 比 WinRAR 的高级功能少

可导出为: ZIP, TAR, ARC, 7Z

适合: PeaZip 非常适合寻找免费、安全且用户友好的工具来管理 XZ 文件的用户。

访问 PeaZip →

The Unarchiver 4.3.1

macOS免费

The Unarchiver 是一款免费的 macOS 应用程序,旨在处理多种归档格式,包括 XZ。它专注于简单性和易用性,使用户能够快速从 XZ 档案中提取文件,而无需复杂的设置。The Unarchiver 在提取过程中保持高保真度,确保数据完整性。

主要功能
  • 轻松提取 XZ 文件
  • 支持多种归档格式
  • 与 Finder 集成
  • 自动文件关联
  • 简单的拖放功能
优点
  • 极其易于使用
  • 轻量且快速
  • 与 macOS 无缝集成
局限
  • 仅限于提取功能
  • 没有压缩的高级功能

可导出为: N/A

适合: The Unarchiver 非常适合需要简单工具的 macOS 用户,用于快速提取 XZ 文件,而无需额外复杂性。

访问 The Unarchiver →

Convert XZ Files

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

Convert XZ Files

参考资料

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