What is GZ (Gzip)?

Discover what GZ (Gzip) files are, how they function, and when to use them. This complete guide covers GZ format details without upload or signup.

Free online file converter tool. Works in Chrome Firefox Safari Edge Opera and other modern browsers on Windows macOS Linux Android and iOS. No software installation or sign-up required. All conversions run directly in your browser, so your files never leave your device. Free to use with no account needed.

GZ

What is GZ (Gzip)?

Complete guide to the GZ file format

Last updated:

Created1992
TypeArchive
Common UseLinux file compression

What is GZ (Gzip)?

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.

How GZ Works

A .gz file is the output of gzip, a single-file stream compressor. The key thing to understand is that gzip compresses one stream of bytes and nothing more: it does not bundle multiple files, it does not store a directory tree, and it keeps no concept of folders. When you see something like backup.tar.gz, the bundling was done first by tar and gzip was then applied to the single resulting stream. This clean separation of jobs, one tool to archive and another to compress, is a defining Unix design choice.

Internally gzip uses the DEFLATE algorithm, which combines two classic techniques. The first is LZ77, a dictionary method that scans the data for sequences it has seen recently and replaces each repeat with a short back-reference, a pointer saying copy N bytes from this many bytes ago. The second is Huffman coding, which then assigns shorter bit patterns to the most frequent symbols and longer ones to rare symbols, squeezing out the remaining redundancy.

The file itself is a small header, the DEFLATE-compressed payload, and a trailer. The header records the original filename and a modification timestamp, and the trailer stores a CRC-32 checksum and the original uncompressed size. That checksum lets a decompressor confirm the data came back exactly as it went in, which is why gzip is considered safe for long-term storage of the streams it handles.

gzip exposes compression levels from 1 (fastest, least compression) to 9 (slowest, smallest). Because DEFLATE decompresses very quickly regardless of the level chosen at encode time, gzip is popular anywhere data is compressed once and read many times, such as web servers sending gzip-encoded responses to browsers on the fly.

History and Standardization

gzip was written by Jean-loup Gailly and Mark Adler in the early 1990s as a free replacement for the older compress utility, whose LZW algorithm was encumbered by patents at the time. Being unencumbered and freely redistributable, gzip was adopted by the GNU project and spread quickly across every Unix-like system.

The formats it depends on are openly documented. The gzip file format is specified in RFC 1952, and the underlying DEFLATE algorithm in RFC 1951. Because these are stable, published specifications rather than a single proprietary program, gzip decompression is built into countless libraries, most notably zlib, the same core code that powers PNG images and much of the web.

Decades later gzip remains a default. It is the baseline content-encoding for HTTP, a standard step in software distribution on Linux, and the g in the ubiquitous tar czf command. Newer algorithms compress better, but gzip's combination of speed, tiny memory footprint, and universal support keeps it in daily use.

GZ Compared to Bzip2, XZ, and Zstandard

Against bzip2 and XZ, gzip trades ratio for speed. bzip2 (a .bz2 file) usually produces a noticeably smaller result but compresses and decompresses more slowly; XZ, built on LZMA2, compresses smaller still but is slower and needs much more memory. gzip is the fast option that wins when you value throughput over the last few percent of size.

The modern challenger is Zstandard (zstd), which at its default settings matches or beats gzip's ratio while decompressing several times faster. Where zstd is available it is often the better technical choice, and it has been added to many Linux distributions and web servers. gzip's advantage over it is purely historical reach: essentially every device, language, and tool already speaks gzip.

It is worth repeating that gzip is a compressor, not an archiver. To keep permissions, ownership, and a folder hierarchy you must pair it with tar, producing a .tar.gz. A bare .gz is only ever the compressed form of one file, which is exactly why it is so common for single large logs, database dumps, and web assets.

Technical Details

DevelopersJean-loup Gailly and Mark Adler[1]
File Extension.gz / .gzip[1]
MIME Typeapplication/gzip[1]
AlgorithmDEFLATE (LZ77 + Huffman coding)[1]
Single FileYes - compresses one file only (use tar for multiple)[1]
StreamingYes - supports on-the-fly streaming compression[1]
Toolsgzip command, zlib library, 7-Zip, WinRAR[1]

GZ vs Other Archive Formats

FeatureGZZIPBZ2XZ
Compression algorithmDEFLATE[1]DEFLATEBWTLZMA2
Multiple filesSingle stream[1]YesSingle streamSingle stream
Compression ratioModerateModerateHighVery high
SpeedFast[3]FastSlowerSlow
Best forSingle-file / streamsGeneral sharingBetter ratioMax ratio

GZ compresses one stream quickly, trading some ratio against the slower but tighter BZ2 and XZ.

Pros and Cons

Advantages

Standard Linux Compression

The universal compression standard on Unix and Linux - available on every system without installation.

Fast Compression Speed

DEFLATE compression is significantly faster than bzip2 or xz, making gzip suitable for frequent compression tasks.

Web Server Compression

Built-in web server feature for compressing HTTP responses, reducing page load times by 60 to 80% for text content.

Streaming Friendly

Supports single-pass streaming compression, making it ideal for compressing data in pipes and over networks.

Disadvantages

Single File Only

Gzip compresses only one file at a time. To compress a directory, you must first create a tar archive.

Weaker Compression than bzip2 or xz

DEFLATE provides good compression but bzip2 and xz consistently produce smaller files at the cost of slower processing.

No Multi-Volume Support

Does not support splitting compressed output across multiple files.

No Internal Directory Structure

Unlike ZIP or 7Z, a .gz file does not contain a directory listing - just compressed data for a single file.

When to Use GZ (Gzip)

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 GZ (Gzip) Files

Need to convert your GZ files? Use our free online converter.

Try Archive Converter Free

How to open a GZ file

GZ files, created using the Gzip compression algorithm, are commonly used for compressing single files or streams. Software for handling GZ files can be categorized into professional tools, free/open-source options, browser-based applications, and built-in utilities. Professional tools are ideal for users needing advanced features and support, while free/open-source options cater to budget-conscious users or developers. Browser-based applications offer convenience for quick tasks, whereas built-in utilities provide basic functionality without additional installations.

When choosing software for GZ files, important factors include feature fidelity, whether the software is intended for editing or simply viewing, and the cost model. Users should consider platform compatibility, as some tools are limited to specific operating systems. Additionally, understanding when to convert GZ files to other formats can influence the choice of software, especially if the user needs to extract or manipulate the contents frequently.

7-Zip 22.01

Windows, macOS, LinuxFree (GPL)

7-Zip is a free and open-source file archiver that supports a wide range of compressed formats, including GZ. It allows users to extract and create GZ files with high fidelity, maintaining the integrity of the original data. The tool is particularly known for its high compression ratios and speed.

Key features
  • Extracts GZ files quickly and efficiently
  • Supports multi-threaded compression
  • Integrates with Windows shell for easy access
  • Offers strong AES-256 encryption for archives
Strengths
  • Completely free with no limitations
  • High compression ratios compared to competitors
  • Supports a wide variety of file formats
Limitations
  • User interface may feel outdated
  • Limited support for advanced editing features

Exports to: ZIP, TAR, 7Z, XZ

Best for: 7-Zip is ideal for users seeking a powerful, free tool to manage GZ files without any cost.

Visit 7-Zip →

WinRAR 6.21

Windows, macOS, LinuxFree trial / One-time $29.00

WinRAR is a popular file compression tool that supports GZ files among many other formats. It provides a user-friendly interface for extracting and creating GZ archives, while also offering features like recovery records for damaged files. WinRAR is known for its robust performance and reliability.

Key features
  • Creates and extracts GZ files seamlessly
  • Offers recovery options for corrupted archives
  • Supports multi-volume archives
  • Integrates with Windows Explorer for easy access
Strengths
  • User-friendly interface with extensive features
  • Reliable recovery options for damaged files
  • Regular updates and strong community support
Limitations
  • Paid software after trial period
  • Limited support for Linux users

Exports to: ZIP, RAR, TAR, CAB

Best for: WinRAR is suitable for users who prefer a comprehensive and reliable tool for managing GZ files with a user-friendly interface.

Visit WinRAR →

PeaZip 9.3.0

Windows, LinuxFree (GPL)

PeaZip is a free file archiver that supports GZ files and offers a wide range of features for file management. It provides a graphical interface for extracting and creating GZ files, along with advanced options for file encryption and secure deletion. PeaZip is particularly favored for its versatility and open-source nature.

Key features
  • Extracts and creates GZ files easily
  • Supports over 180 archive formats
  • Offers strong file encryption options
  • Includes file integrity checks
Strengths
  • Completely free and open-source
  • Supports a vast array of formats
  • Advanced security features for sensitive files
Limitations
  • Interface may be complex for beginners
  • Performance can lag with large files

Exports to: ZIP, TAR, 7Z, ARC

Best for: PeaZip is perfect for users looking for a free, versatile tool that handles GZ files and offers advanced security features.

Visit PeaZip →

The Unarchiver 4.3.0

macOSFree

The Unarchiver is a free extraction tool for macOS that supports GZ files among many other formats. It is designed to be a simple and effective solution for extracting compressed files, ensuring that users can easily access their content without hassle. The Unarchiver focuses on ease of use and compatibility with various archive formats.

Key features
  • Extracts GZ files with a simple drag-and-drop
  • Handles a wide range of archive formats
  • Preserves file attributes during extraction
  • Integrates seamlessly with macOS Finder
Strengths
  • Extremely user-friendly for macOS users
  • Fast extraction speeds
  • Supports many archive formats beyond GZ
Limitations
  • Limited to extraction, no creation of GZ files
  • Not available on Windows or Linux

Exports to: None (extraction only)

Best for: The Unarchiver is ideal for macOS users who need a straightforward tool for extracting GZ files without additional complexity.

Visit The Unarchiver →

References

  1. GZIP File Format - RFC 1952 (IETF)
  2. GZIP - Library of Congress
  3. gzip - Wikipedia