What is GZ (Gzip)?
Complete guide to the GZ file format
What is it?
GZ (Gzip) is a file compression format and software program created by Jean-loup Gailly and Mark Adler in 1992. It uses the DEFLATE compression algorithm, which combines LZ77 lossless data compression with Huffman coding. Gzip was created as a free replacement for the Unix compress program, which used an algorithm encumbered by patents. The .gz extension indicates a single file compressed with gzip; for directory archives, gzip is typically combined with tar to create .tar.gz or .tgz files.
Gzip is the standard compression tool on Linux and Unix systems and is built into virtually every Linux distribution. It is widely used for compressing log files, configuration files, and software packages. Web servers use gzip compression to reduce the size of HTML, CSS, JavaScript, and JSON responses before sending them to browsers, typically reducing text content by 60 to 80%. The gzip format includes a simple header with filename and modification time, followed by the compressed data stream.
Technical Specifications
Pros & Cons
Advantages
The universal compression standard on Unix and Linux - available on every system without installation.
DEFLATE compression is significantly faster than bzip2 or xz, making gzip suitable for frequent compression tasks.
Built-in web server feature for compressing HTTP responses, reducing page load times by 60 to 80% for text content.
Supports single-pass streaming compression, making it ideal for compressing data in pipes and over networks.
Disadvantages
Gzip compresses only one file at a time. To compress a directory, you must first create a tar archive.
DEFLATE provides good compression but bzip2 and xz consistently produce smaller files at the cost of slower processing.
Does not support splitting compressed output across multiple files.
Unlike ZIP or 7Z, a .gz file does not contain a directory listing - just compressed data for a single file.
When to Use It
Here are the most common situations where GZ (Gzip) is the right choice:
Linux Log Compression
Compress and archive log files on Linux servers using gzip to save disk space.
Software Distribution on Linux
Source code tarballs (.tar.gz) are the standard distribution format for open-source software.
Web Server Optimization
Configure Apache, Nginx, or other web servers to gzip HTML, CSS, and JavaScript responses automatically.
Data Pipeline Compression
Use gzip in shell pipelines to compress data streams between processes without writing temporary files.
Convert Your Files Online - Free
Our free online converter supports all major formats. No software to install, no registration required.
Start Converting NowFrequently Asked Questions
What is the difference between .gz and .tar.gz?
A .gz file is a single file compressed with gzip. A .tar.gz (or .tgz) file is a tar archive of multiple files and directories that has been compressed with gzip. Most Linux software is distributed as .tar.gz packages.
Is gzip the same as ZIP?
No. Gzip and ZIP both use the DEFLATE algorithm, but they are different formats. ZIP is a container that can hold multiple files with individual compression. Gzip compresses a single file; it is used with tar for multi-file archives.
How do I decompress a .gz file on Linux?
Use the command: gunzip filename.gz - or: gzip -d filename.gz - For .tar.gz files: tar -xzf filename.tar.gz
Can I open GZ files on Windows?
Yes. 7-Zip, WinRAR, and WinZip can extract .gz files on Windows. These applications handle both .gz and .tar.gz files.
What compression level should I use?
The default gzip compression level (6 of 9) provides a good balance of speed and size. Use -9 for maximum compression when size is critical and speed is not.