What is the Z file format?
.z is a compressed file format associated with the Unix environment, created by the compress utility in 1984. .z was for a long time the main compression standard for Unix systems. .z files are created by issuing the compress filename command; the original file is replaced in place. Decompression can be performed by using the uncompress filename.z command or via zcat. .z uses the LZW (Lempel-Ziv-Welch) algorithm - a rather simple scheme that is fast but not efficient by modern standards. Every .z stream is identified by the two-byte magic number 1F 9D; the third byte encodes the LZW bit-width flag. Because compress handles only a single file at a time, multiple files were typically bundled with tar first, producing .tar.z archives (also written .taz).
Evolution of compression methods
The .z format has been almost completely displaced by the .gz format used by gzip. .z files can be converted to .gz easily without unpacking - zcat file.z | gzip > file.gz does the job. Gzip is today the standard compression tool for Unix-like systems, while modern workflows increasingly favor .xz or .bz2 for better compression ratios.
Security & safety
RISK: LOWThe .Z format itself is passive and safe - it's just LZW-compressed data and cannot execute. As with any archive, the only risk is the CONTENTS: a .tar.Z from an untrusted source could contain scripts or executables, so scan/inspect what you extract before running anything. Because .Z is old and rare today, an unexpected one arriving by email is unusual - verify the sender. There is no password/encryption in classic compress, so .Z offers no confidentiality.
Format details
in a nutshellPrograms that open Z files
Technical details
deep spec| Algorithm | LZW (Lempel-Ziv-Welch) adaptive dictionary compression |
| Magic bytes | `1F 9D` at file offset 0 |
| Header structure | 3-byte header - magic `1F 9D` plus an options byte encoding max bit-width and block-mode flag |
| LZW bit-width range | 9 to 16 bits; default maximum is 16 bits |
| Block mode | Optional dictionary-reset mode; signalled by bit 7 (0x80) of the third header byte |
| MIME type | `application/x-compress` |
| Single-file scope | Each `.z` stream compresses exactly one file; multi-file bundles require a prior `tar` step |
| Compound archive form | `.tar.z` (also `.taz` / `.tz`) - a `tar` archive subsequently compressed with `compress` |
| Decompression commands | `uncompress filename.z`, `zcat filename.z`, or `gzip -d filename.z` |
| LZW patent history | LZW was patented by Unisys/Sperry; patents expired around 2003, ending earlier licensing concerns |
| Magic-byte distinction from gzip | Both `.z` and `.gz` start with `1F`; second byte differs - `9D` for `.z`, `8B` for `.gz` |
| Compression efficiency | Lower compression ratio than gzip, bzip2, or xz on typical data types |
| Originating utility | BSD `compress` written by Spencer Thomas et al.; replaced by gzip as the standard Unix compression tool |
| Windows support | Not natively supported on Windows; requires third-party tools such as 7-Zip, WinRAR, or WinZip |
| Released | 1984 (BSD compress utility, Unix) |
| Open standard | Yes · royalty-free |
| Specification | en.wikipedia.org |
Z conversions
Community Q&A
asked by usersNo questions yet - be the first to ask about Z files.