00

The short answer

  • XZ is a compressed-stream container that stores the bytes of one file per stream, although one .xz file may contain multiple concatenated streams.
  • Open or decompress an XZ file with XZ Utils or a compatible implementation such as 7-Zip, XZ Embedded, XZ for Java, or the LZMA SDK. Decompression restores the original byte stream; the result may itself need another suitable application.
  • Treat an untrusted XZ file as medium risk. Valid structure or a matching magic number does not establish that its contents are trustworthy. Some files can require several GiB of memory or decode extremely slowly, so apply a decompression memory limit such as XZ Utils' --memlimit-decompress.
01

XZ Compressed Data (.xz)

An XZ stream contains a Stream Header, zero or more Blocks, an Index, and a Stream Footer. It supports up to four chained filters and commonly uses LZMA2, optionally with BCJ or Delta filters. XZ is not a multi-file archive format.

Keep the original

To convert XZ to another compression format, first recover the original byte stream and then compress that payload in the target format. The payload is normally retained, but XZ-specific blocks, filter chains, check type, Index, concatenated streams, and padding layout are not.

02

How to open it

Open or decompress an XZ file with XZ Utils or a compatible implementation such as 7-Zip, XZ Embedded, XZ for Java, or the LZMA SDK. Decompression restores the original byte stream; the result may itself need another suitable application.

I only want to read it

Open or decompress an XZ file with XZ Utils or a compatible implementation such as 7-Zip, XZ Embedded, XZ for Java, or the LZMA SDK. Decompression restores the original byte stream; the result may itself need another suitable application.

I need to send it to someone

To convert XZ to another compression format, first recover the original byte stream and then compress that payload in the target format. The payload is normally retained, but XZ-specific blocks, filter chains, check type, Index, concatenated streams, and padding layout are not.

03

File safety

Treat an untrusted XZ file as medium risk. Valid structure or a matching magic number does not establish that its contents are trustworthy. Some files can require several GiB of memory or decode extremely slowly, so apply a decompression memory limit such as XZ Utils' --memlimit-decompress.

Stop if any of this looks off

An unknown sender, a name ending in two extensions, or contents that do not match the extension — check before you open it.

04

Converting it

To convert XZ to another compression format, first recover the original byte stream and then compress that payload in the target format. The payload is normally retained, but XZ-specific blocks, filter chains, check type, Index, concatenated streams, and padding layout are not.

Before you convert

Convert a copy, never the original, then compare quality, metadata, and layout against what you started with.

05

Common questions

What is an XZ compressed file used for?

An XZ file is a compressed-stream container. Each XZ stream carries one file's byte content, while a single .xz file may concatenate multiple streams; it does not by itself store a multi-file archive structure.

How do I open an XZ file?

Use XZ Utils or a compatible implementation such as 7-Zip, XZ Embedded, XZ for Java, or the LZMA SDK. Decompressing a valid file restores its original uncompressed byte stream.

How do I open an XZ file on Windows?

Use 7-Zip or another listed XZ-compatible implementation to decompress the .xz file. Then open the recovered byte stream with an application appropriate for its actual file type.

How do I open an XZ file on a Mac?

Use XZ Utils or another implementation that explicitly supports XZ. Decompress the file first, then use a suitable application for the recovered file type.

How do I open an XZ file on an Android phone?

Choose an Android application whose documentation explicitly states that it supports XZ decompression. The XZ format itself does not identify which application is needed for the recovered byte stream.

Why will an XZ file not decompress?

Check whether its first six bytes match FD 37 7A 58 5A 00 and whether the decoder reports corruption, an unsupported filter chain, or insufficient resources. A matching signature identifies XZ structure but does not prove that the complete stream is intact.

What is the difference between XZ and TAR.XZ?

XZ compresses byte streams and does not store a multi-file archive structure. TAR.XZ commonly refers to a tar archive carried as the single payload of XZ compression, so the archive structure belongs to tar, not XZ.

Can I convert XZ to ZIP without losing data?

A valid XZ stream can be decompressed to its original bytes and those bytes can be placed in another compression format. XZ-specific block boundaries, filters, checks, Index, concatenation, and padding are not preserved, and ACLs or extended attributes may also be absent.

Is an XZ file received as an email attachment safe?

Do not infer safety from the .xz extension, MIME type, signature, or successful decompression. Untrusted files can consume large amounts of memory or decode very slowly; use resource limits and assess the recovered content separately.

What memory limit should I use when decompressing an XZ file?

There is no single limit suitable for every file. Some XZ files require several GiB of memory, and the single-threaded decompression limit may not be enabled by default, so set an explicit --memlimit-decompress value appropriate to your device.

06

Related formats

Sources

The .xz File Format Specification 1.2.1 · XZ Utils 官方格式规范

The .xz file format · XZ Utils 官方格式与实现说明

XZ(1) Manual Page · XZ Utils 官方命令手册

PRONOM fmt/1098: XZ File Format · 英国国家档案馆 PRONOM 格式注册库