What is a .z file?
Unix Compress File · Archive · Spencer Thomas et al. · 1984
A .Z file is compressed with the old Unix compress program, using LZW compression. It predates gzip and is now largely historical, but still appears in old Unix archives and man-page bundles.
What is a .z file used for?
The .Z format starts with the magic bytes 1F 9D. It was the standard Unix compressor before gzip, which replaced it with better ratios and no patent worries.
You will meet .Z mostly with legacy files. gunzip and most archive tools still decompress it; re-compress with gzip or zstd for anything current.
How to open a .z file
The .z format opens in the following apps, grouped by operating system. If one app does not work, try another from the same list. For a step-by-step walkthrough, see how to open a .z file.
Windows
- 7-Zip
- WinRAR
macOS
- The Unarchiver
- uncompress (command line)
Linux
- gunzip
- uncompress
- zcat
How to convert a .z file
You can convert a .z file to gz, zip using a conversion tool or the export menu of an app that opens it.
.z file signature (magic bytes)
Programs recognise a .z file by the bytes at the start of the file, not by its name. These are the signatures for Z. For a full breakdown, see the Z file signature page.
| Hex signature | Offset | Note |
|---|---|---|
| 1F 9D | 0 | LZW compress magic |
See the full magic-numbers reference for every format.
Frequently asked questions
What is a .z file?
A .Z file is compressed with the old Unix compress program, using LZW compression. It predates gzip and is now largely historical, but still appears in old Unix archives and man-page bundles.
How do I open a .Z file?
gunzip or uncompress on Unix decompress it, and 7-Zip does on Windows. A .tar.Z unpacks with tar -xf after decompressing.
What is the difference between .Z and .gz?
.Z is the older Unix compress format (LZW); .gz is gzip, which replaced it with better compression. Tools read both.
Is .Z still used?
Rarely. It survives in legacy Unix archives; new files use gzip, xz or zstd instead.
Related formats
Sources
Details on this page were checked against authoritative references: