GZ (Gzip Compressed File)
The workhorse of Unix compression since 1992, used everywhere from web servers to Linux package repos.
| Full name | Gzip Compressed File |
| Extension | .gz |
| MIME type | application/gzip |
| Developer | Jean-loup Gailly and Mark Adler |
| Released | 1992 (v0.1 on October 31, 1992) |
| Type | Archive / Compression |
| Specification | RFC 1952 (GZIP file format specification v4.3) |
| Compression algorithm | DEFLATE (RFC 1951) |
What is a GZ file?
GZ is a single-file compression format that uses the DEFLATE algorithm to shrink data. It was created in 1992 by Jean-loup Gailly and Mark Adler as a patent-free replacement for the Unix compress program. The format is specified in RFC 1952 and is one of the most widely supported compression formats on any platform.
A .gz file is a single file wrapped in a gzip container. The container holds a short header, a DEFLATE-compressed payload, and a trailer with a CRC-32 checksum and the original file size. Unlike ZIP, gzip does not bundle multiple files into one archive â it compresses exactly one file. To archive a folder, gzip is typically combined with tar, producing the .tar.gz or .tgz format.
History
Jean-loup Gailly designed the gzip format and wrote the initial compression code; Mark Adler wrote the decompression half. Version 0.1 was released on October 31, 1992, and version 1.0 followed in February 1993. The format was created to work around LZW patents held by Unisys and IBM that covered the older compress utility. The file format was formally documented in RFC 1952, published in May 1996 by P. Deutsch at Aladdin Enterprises.
How it works
Every .gz file starts with a fixed 10-byte header. The first two bytes are the magic number 0x1F 0x8B, which identifies the file as gzip. The third byte is always 0x08, indicating the DEFLATE compression method. Optional header fields can store the original filename, a comment, a modification timestamp, and a header checksum. After the header comes the raw DEFLATE-compressed data. The file ends with an 8-byte trailer: a CRC-32 of the uncompressed content and the original file size modulo 2^32.
What it is used for
- Compressing log files and backups on Linux and macOS servers
- Serving web assets with Content-Encoding: gzip to reduce transfer size
- Distributing source code and binaries as .tar.gz archives
- Compressing database dumps before storage or transfer
How to open it
On Linux and macOS, use the built-in gzip or gunzip command, or open .gz files with tools like 7-Zip, The Unarchiver, or PeaZip on Windows. Most modern archive managers recognize the format automatically.
Pros and cons
Strengths
- Lossless compression â the decompressed file is bit-for-bit identical to the original
- Built into virtually every Linux distribution and macOS out of the box
- CRC-32 checksum catches corruption during storage or transfer
- Widely supported by web servers for on-the-fly HTTP compression
Trade-offs
- Compresses only one file at a time â folder archiving requires tar first
- Slower and slightly lower compression ratio than newer formats like Zstandard or Brotli
- No built-in encryption or password protection
- Cannot compress multiple files into a single archive without a wrapper like tar
Convert GZ files
Free, in your browser, no signup. Start at the GZ converter, or jump straight to a popular conversion below.
Curious how fast and how small? See our measured conversion benchmarks.
GZ FAQ
What is the difference between .gz and .tar.gz?
A .gz file is a single compressed file. A .tar.gz (also called .tgz) is a tar archive â which bundles multiple files and folders into one file â that has then been compressed with gzip. To get a folder out of a .tar.gz, you need to both decompress and untar it.
Is gzip the same as ZIP?
No. Both use the DEFLATE algorithm internally, but they are different formats. ZIP bundles multiple files in one archive and compresses each file independently. Gzip compresses a single stream and is typically paired with tar when multiple files are involved. They are not interchangeable.
Can I open a .gz file on Windows?
Yes. Tools like 7-Zip, WinRAR, and PeaZip all support .gz files on Windows. Windows 11 also has basic built-in support for extracting .tar.gz archives through File Explorer.
Does gzip preserve the original filename?
Optionally. The gzip header has a field where the original filename can be stored. The command-line gzip tool writes it by default. Some tools omit it, so the decompressed file may inherit the .gz filename with the extension stripped.