.z

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.

Category
Archive
Type
Binary
Is a .z file safe to open? Safe to extract with a trusted tool.

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.

What opens 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.

Windows

  • 7-Zip
  • WinRAR

macOS

  • The Unarchiver
  • uncompress (command line)

Linux

  • gunzip
  • uncompress
  • zcat

Open a .z file step by step

  1. Confirm the file really is a .z. Drop it into the WhatFileType identifier, which reads its signature in your browser without uploading anything.
  2. On Windows, open it with 7-Zip or WinRAR.
  3. On Mac, use The Unarchiver or uncompress (command line).
  4. On Linux, try gunzip or uncompress.
  5. Still stuck? Convert the .z to gz, which opens more widely.

Why can't I open my .z file?

Almost always because no installed app understands Z. Install one of the apps above, or convert the file to a format your existing software already reads. If double-clicking opens the wrong program instead of nothing at all, the file association is set to the wrong app rather than the file being broken.

The other possibility is that the file is not really a .z at all. Drop it into the file identifier to check it by its bytes instead of its name. Nothing is uploaded.

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.

What is the .z file signature (magic bytes)?

A .z file starts with the hex bytes 1F 9D. Programs identify Z by those bytes, not by the filename, so a renamed file still gives itself away.

These are the documented signatures for Z. For a full breakdown, see the Unix compress (.Z) file signature page.

Documented magic-byte signatures for the .z format
Hex signatureOffsetASCIINote
1F 9D0-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. How sources are ranked and what is deliberately left out is set out in the methodology.