Z (Unix Compress) Format Guide
Available Conversions
Convert Z to ZIP for universal cross-platform compatibility
Convert Z to TAR for Unix-standard archiving with metadata preservation
Convert Z to GZ — upgrade to the modern gzip successor format
Convert Z to BZ2 for superior compression with block recovery
Convert Z to XZ for maximum LZMA2 compression
Convert Z to 7Z for maximum compression with encryption and multi-file support
About Z (Unix Compress) Format
The Z format is produced by the Unix compress utility, the original standard compression tool on Unix systems. Introduced in 1984 by Spencer Thomas, Jim McKie, Steve Davies, Ken Turkowski, James A. Woods, and Joe Orost, compress uses the Lempel-Ziv-Welch (LZW) algorithm to reduce file sizes. The LZW algorithm builds an adaptive dictionary of patterns found in the input data, starting with 9-bit codes and growing up to 16-bit codes as the dictionary expands. Files compressed with this utility receive the .Z extension (uppercase), which distinguishes them from gzip's .gz (lowercase) output.
History of Unix Compress
The compress utility emerged from work at several institutions in the early 1980s. Spencer Thomas wrote the first version based on the LZW algorithm described by Terry Welch in his 1984 IEEE Computer paper "A Technique for High-Performance Data Compression." The tool was included in 4.3BSD (Berkeley Software Distribution) and rapidly became the standard compression utility across all Unix variants — SunOS, HP-UX, AIX, Ultrix, and others. The combination of compress with tar (.tar.Z) became the universal way to distribute software on Unix before the internet era, spreading through Usenet, FTP archives, and magnetic tape. The format's downfall came in 1994 when Unisys, which held the LZW patent through its acquisition of Sperry Corporation, began demanding licensing fees from software using LZW compression. This patent enforcement, which also affected the GIF image format, prompted the GNU project to create gzip as a patent-free replacement using the DEFLATE algorithm. By the mid-1990s, most Unix distributions had replaced compress with gzip, and .tar.gz superseded .tar.Z as the standard distribution format. The US LZW patent (No. 4,558,302) expired on June 20, 2003, but by then gzip's dominance was absolute.
Technical Details
The LZW algorithm used by compress operates by building a dictionary of strings encountered in the input. Starting with a dictionary of 256 single-byte entries (plus a clear code), it reads input characters and extends matches against the dictionary, emitting codes for the longest match found and adding new strings to the dictionary. The code width starts at 9 bits and increases as the dictionary grows, up to a maximum configurable between 9 and 16 bits (16 is the default and most common). When the dictionary fills, compress resets it and starts fresh. The .Z file format begins with a two-byte magic number (0x1F 0x9D), followed by a header byte containing the maximum code width and a flag indicating whether block compression (dictionary reset) is enabled. The remainder is a continuous stream of variable-width LZW codes. Unlike its successor gzip, the .Z format includes no checksum or integrity verification mechanism.
Common Applications
Today, .Z files are primarily encountered in legacy contexts: old Unix system backups recovered from tape, archived software distributions from FTP mirrors of the 1980s and 1990s, historical Usenet file distribution, compressed man pages on old Unix installations, and academic/research data archives from early workstations (SGI, Sun, HP, DEC). Some embedded systems and specialized environments still use LZW compression for its simplicity and low resource requirements. The gzip utility maintains backward compatibility with .Z files — running "gzip -d file.Z" or "gunzip file.Z" will decompress compress-format files, ensuring that legacy .Z archives remain accessible even on systems that do not have the compress command installed.
Advantages and Disadvantages
Advantages
- Historical Standard: Was available on every Unix system in the 1980s-1990s
- Fast Decompression: LZW decoding is simple and very fast
- Low Resources: Minimal CPU and memory requirements
- Gzip Compatible: Gzip can decompress .Z files natively
- Simple Algorithm: Well-understood, predictable behavior
- Stable Format: Binary format unchanged since 1984
- Streaming: Supports pipe-based compression/decompression
- Self-Contained: No external library dependencies
Disadvantages
- Poor Compression: LZW ratios far below modern algorithms
- No Checksums: No integrity verification — silent corruption possible
- Patent History: LZW patent caused industry-wide abandonment
- Single File: Cannot archive directories without tar
- No Encryption: No password protection capability
- Obsolete: Not installed by default on modern systems
- No Recovery: No error correction or block recovery
- Limited Tools: Few modern tools create .Z files