Skip to content
Aback ZIP

Formats · 5 min read · Updated

How to open .xz, .bz2 and .zst files

What XZ, BZIP2, Zstandard and LZMA files are, where they come from, and how to decompress them on Windows, macOS, Linux or in your browser.

.xz, .bz2 and .zst are compression formats, like .gz. Each holds a single compressed file, and very often that file is a TAR archive, giving names like project-2.4.tar.xz or backup.tar.zst. Windows and macOS don't always open them with a double-click, but they are easy to decompress once you know what you have.

What these formats are

ExtensionFormatWhere you see itIn short
.xz, .txzXZ (LZMA2)Source code releases, Linux packagesSmall files; slower to compress, reasonably fast to decompress.
.bz2, .tbz2BZIP2Older source releases, large data dumpsCompresses text better than GZIP, but slowly; mostly replaced by XZ and Zstandard.
.zst, .tzstZstandardLinux packages, backups, database and log toolsFast to compress and decompress, with good ratios.
.lzma, .tlzLZMAOlder releasesThe predecessor of XZ, without its integrity checks.
.gz, .tgzGZIPEverywhere: logs, web servers, source codeThe fastest and most widely supported, with larger files.

None of these is an archive on its own: each compresses exactly one file. To pack a folder, Unix tools first bundle it into a TAR, then compress the TAR. That is why you see two extensions, and why decompressing project.tar.xz gives you project.tar, not a folder. The short forms .txz, .tbz2, .tzst, .tlz and .tgz mean the same as .tar.xz, .tar.bz2, .tar.zst, .tar.lzma and .tar.gz.

Where you'll meet them

  • Source code releases, often published as .tar.xz or .tar.gz, and sometimes .tar.bz2.
  • Linux packages: Arch Linux packages end in .pkg.tar.zst, and Debian and Ubuntu .deb packages contain XZ- or Zstandard-compressed TARs inside.
  • Database dumps and data exports, such as dump.sql.xz, pages-articles.xml.bz2 or events.json.zst.
  • Backups and logs, where Zstandard and XZ keep large files small.

Open them in your browser

XZ, BZ2 & ZST Extractor decompresses a single .xz, .bz2, .zst, .lzma or .gz file in your browser, with nothing to install. The format is detected from the file's bytes, so a misnamed file still works. XZ check values and BZIP2 CRCs are verified as it decompresses; Zstandard checksums are not.

If the file is a compressed TAR, open it directly with Extract TAR to browse the folders and download what you need, or convert it for people who prefer ZIP with TAR to ZIP.

Not supported in the browser: XZ files that use BCJ filters, Zstandard files made with a dictionary, and files that need a decompression window over 1 GB. Use the command-line tools below for those.

Open them on Windows

7-Zip opens .xz, .bz2 and .lzma, and recent versions also open .zst. As with .tar.gz, it treats a compressed TAR as two layers: extract once to get the .tar, then again to get the files. Recent versions of Windows 11 can also open several of these formats in File Explorer, mainly when they contain a TAR.

Open them on macOS and Linux

In the Terminal, tar detects the compression itself when extracting compressed TARs:

tar -xf project.tar.xz
tar -xf data.tar.bz2
tar -xf backup.tar.zst

For single compressed files, use the matching tool. -k keeps the compressed file; zstd keeps it by default.

xz -dk dump.sql.xz
bzip2 -dk pages-articles.xml.bz2
zstd -d events.json.zst

Most Linux distributions include xz and bzip2; zstd may need to be installed from the package manager. On macOS, bzip2 is built in, and xz and zstd can be installed with Homebrew. If tar can't handle .tar.zst on your system, install zstd first.

Tools for this

Frequently asked questions

Yes. .txz is a short form of .tar.xz, just as .tgz is of .tar.gz, .tbz2 of .tar.bz2 and .tzst of .tar.zst. All of them are TAR archives with a compression layer.

More guides