What Is a .Z File? (The Original Unix Compress Format From 1984-85)
The LZW algorithm, the Sperry/Unisys patent that outlived its own popularity, and why gzip replaced this format as the default Unix compressor.
- Add a file Choose or drop it here
- Pick the format Change it whenever needed
- Download the result After conversion completes
The Unix Utility Behind the .Z Extension
A .Z file is the output of the Unix compress command, a single-file compression utility that has nothing to do with the Windows Compress/Extract shell menu or any modern archive tool despite sharing a similar name. Spencer Thomas at the University of Utah wrote the original implementation in 1984, and Joseph Orost led further work with Thomas and others to finalize version 4.0 in 1985, which was published as free software to the net.sources Usenet group. compress quickly became the standard Unix compression tool of its era, replacing an even older, less efficient utility called pack.
Structurally, a .Z file always holds exactly one compressed file — the format has no concept of bundling multiple files or folders the way ZIP or TAR does, which is why compressed Unix archives from that era are almost always seen as ".tar.Z," a plain tarball built with TAR first and then run through compress second, the exact same two-step pattern gzip and XZ use with TAR today.
The command itself is also the source of a small but genuinely useful safety feature still found in some modern tools that trace their lineage back to it: compress checks a magic number before attempting to decompress a file, refusing to run on a file that doesn't actually start with that signature, and it also refuses to compress a file that's already compressed, since doing so would only add overhead without shrinking anything further. Both checks were meant to prevent exactly the kind of user error — decompressing garbage or double-compressing an already-compressed file — that was common when compress was new and widely used across many different Unix systems with varying levels of user experience.
Adaptive LZW Coding With Codes That Grow From 9 to 16 Bits
The compress utility uses the LZW algorithm — named for Abraham Lempel, Jacob Ziv, and Terry Welch — which builds a dictionary of repeated byte sequences as it scans through the file and replaces those sequences with shorter numeric codes pointing back into that dictionary. What makes compress's specific implementation notable is that it starts encoding with 9-bit codes and adaptively grows the code size up to a configurable maximum, typically capped at 16 bits, as the dictionary fills up with more entries, which is a specific technical detail that distinguishes it from later, unrelated LZW variants used elsewhere.
The compressed .Z file itself begins with a fixed magic number so decompression tools can confirm the file is actually compress output rather than random data, followed by a byte encoding the maximum code size that was used, information the decompressor needs to correctly rebuild the dictionary in reverse. This adaptive-width design let compress do meaningfully better than fixed-width coding schemes on typical text and program files of the era, without needing anywhere near the memory or CPU time that later, more sophisticated algorithms would eventually require.
This lightweight design was a deliberate tradeoff for the hardware of its time. Machines running Unix in the mid-1980s had a small fraction of the memory and processing power of even a low-end device today, so an algorithm that could compress reasonably well while using a modest, bounded dictionary size was far more practical than a heavier scheme that might compress better but take an impractical amount of time or memory to run on that era's hardware.
The Patent Fight That Pushed the Entire Industry Toward DEFLATE
- A patent nobody using compress initially knew about: Sperry Research Center had filed for a patent on LZW in 1983, and U.S. patent 4,558,302 was granted in 1985, the same year compress 4.0 shipped as free software, with the patent's existence going largely unnoticed by early adopters.
- Sperry's merger turned quiet ownership into active enforcement: Sperry later merged into Unisys, and it was Unisys that eventually began enforcing the LZW patent commercially, most famously against GIF, which used the same algorithm.
- The December 1994 GIF royalty announcement changed the wider conversation: Unisys and CompuServe announced that commercial software using LZW-based GIF encoding would need to pay licensing fees, triggering community backlash across the software industry, not just among compress users specifically.
- PNG exists specifically because of this patent dispute: Thomas Boutell proposed a royalty-free replacement image format on the comp.graphics Usenet newsgroup in January 1995, within about three months of the Unisys announcement, and that proposal became PNG.
- Gzip displaced compress years before the patent actually expired: the U.S. LZW patent expired in 2003, but gzip, built on the patent-free DEFLATE algorithm, had already become the default Unix compression tool well before then, specifically to avoid any patent licensing exposure at all rather than waiting out the clock.
Where a .Z File Still Turns Up Today
Despite gzip's takeover, .Z files haven't fully vanished — they still surface most often in old software archives, legacy Unix system backups, decades-old FTP mirrors, and some older man-page distributions that were compressed with compress long before gzip existed and were never repackaged afterward. Modern Linux distributions still ship compress-compatible decompression through tools like gzip's own zcat and uncompress commands, or through 7-Zip on Windows and The Unarchiver on macOS, which is why opening an old .Z file today is rarely a real obstacle even though almost nothing still creates new ones by default.
macOS and current Linux distributions both retain some form of native or easily installed .Z decompression precisely because so much legacy Unix documentation and archived source code from the 1980s and 1990s still exists in this format, and losing the ability to open it would mean losing access to a real slice of computing history rather than just an inconvenience for a handful of files.
Beyond compress itself, LZW's broader legacy is bigger than this one file extension suggests. The same algorithm underlies the classic GIF image format and is one of the compression options inside TIFF, which is exactly why the Unisys patent dispute wasn't a narrow Unix-tools issue — it touched image formats used across the entire web at the time, and the fallout from that dispute shaped compression-format decisions in software far removed from anything resembling a .Z file.
The Actual Confusion Behind "Compress" and ".Z" Today
A specific, recurring point of confusion in tech support threads is someone using Windows' "Compress to zip file" right-click option and expecting the result to be a .Z file, when in fact that Windows feature produces a standard .zip archive with no relationship to Unix compress at all — the naming overlap between "compress" as a general English verb and compress as a specific 1984 Unix program is coincidental, not a shared format. Anyone actually working with genuine .Z files today is almost always dealing with an old Unix-originated archive, not anything created by modern Windows or macOS software.
A second, more technical issue that occasionally surfaces involves the code-size limit compress used when creating the file: older systems sometimes capped compression at a lower maximum bit width than modern decompressors expect by default, and a small number of very old .Z files can trip up decompression tools that assume a specific, newer maximum without checking the byte in the file header that actually records what code size was used. This is documented directly in the compress format's own magic-number-plus-flag-byte header design, and correctly reading that header byte, rather than assuming one fixed setting, is what any properly written decompressor needs to do.
The Classic Unix Compressor Set Beside Its Modern Replacement
| Feature | Compress (.Z) | Gzip (.gz) |
|---|---|---|
| Algorithm | LZW, adaptive 9-16 bit codes | DEFLATE (LZ77 + Huffman) |
| Release era | 1984-1985 | Early 1990s |
| Patent status at release | Patented (Sperry/Unisys), unenforced at first | Patent-free by design |
| Files per archive | One; needs TAR for multiple | One; also commonly paired with TAR |
| Typical compression ratio | Lower than DEFLATE on most data | Higher than LZW on most data |
| Current default status | Legacy; rarely created new | Still a common Unix default |
Common Questions About Opening Old Compress Archives
What software created my .Z file?
Almost certainly the Unix compress command, first written in 1984 by Spencer Thomas and finalized as version 4.0 in 1985 — a completely different tool from Windows' modern "compress to zip" feature despite the similar wording.
Why did compress get replaced by gzip?
Mainly because of the Unisys patent on the LZW algorithm compress relies on. Once Unisys began enforcing that patent commercially in the mid-1990s, the Unix world shifted to gzip's patent-free DEFLATE algorithm rather than risk licensing exposure, well before the LZW patent actually expired in 2003.
Can modern computers still open .Z files?
Yes. Tools like gzip's own uncompress and zcat commands on Linux, 7-Zip on Windows, and The Unarchiver on macOS all still read the format, even though almost nothing creates new .Z files by default anymore.
Is a .Z file the same as a .zip file?
No. They are unrelated formats that happen to share similar names. .Z comes from the 1984-85 Unix compress utility using LZW compression, while .zip is PKWARE's 1989 archive format using DEFLATE by default.