GZ (.gz)
GNU Zip compression format using the Deflate algorithm. Used to compress single files on Unix/Linux systems and as the compression layer in .tar.gz archives.
- Extension
- .gz
- MIME Type
- application/gzip
Last updated
Overview
GZ (GNU Zip) is a file compression format using the Deflate algorithm, developed by Jean-loup Gailly and Mark Adler as a free replacement for the patent-encumbered Unix compress command. Released in 1992, gzip (GNU Zip) became the standard compression utility on Unix/Linux systems.
GZ compresses a single file — it cannot bundle multiple files like ZIP or TAR. This is why GZ is almost always combined with TAR for distributing multiple files as .tar.gz (often pronounced "tar-gee-zee" or "tarball"). GZ is also used as HTTP content encoding: web servers compress responses with gzip to reduce bandwidth, and browsers transparently decompress them.
Common Uses
- Single file compression — compressing large text files, logs, and database dumps on Linux
- Log rotation — Linux systems automatically compress old log files as
.gzwith logrotate - HTTP compression — web servers serve gzip-compressed HTML, CSS, and JavaScript for faster page loads
- Combined with TAR —
.tar.gzarchives for distributing multiple files on Linux/Unix - Database backups — MySQL and PostgreSQL dump files are commonly gzip-compressed
Advantages
- Fast compression/decompression — Deflate algorithm balances speed and ratio well
- Universal Linux support — gzip is installed on every Linux and macOS system by default
- Streaming-capable — compresses and decompresses in a single pass, suitable for pipes and streams
- Good text compression — particularly effective on text files (source code, logs, HTML), achieving 60–80% reduction
Limitations
- Single file only — cannot compress multiple files without TAR
- Lower ratios than bzip2/xz — gzip prioritises speed; bzip2 and xz achieve better compression at the cost of speed
- No integrity headers for content — gzip verifies the compressed data with CRC32 but does not checksum the original file independently
Supported Software
- Linux/macOS:
gzip,gunzip,zcat(all built-in) - Windows: 7-Zip, PeaZip, WinRAR, WSL
- Programmatic: Python gzip module, Java GZIPInputStream, Node.js zlib