FormatDrop
Document Format

GZ

Gzip Compressed File

GZ (gzip) is a file compression format based on the DEFLATE algorithm (LZ77 + Huffman coding), created in 1992 as a free replacement for the patented Unix compress tool. A .gz file is a single file compressed with gzip — it is not an archive (TAR is). Gzip is one of the most widely used compression tools in computing: web servers use it for HTTP content-encoding (shrinking HTML/CSS/JS before sending to browsers), Linux packages use .tar.gz for distribution, and log rotation tools compress old logs to .gz to save disk space.

What is GZ?

When you run `gzip file.txt`, gzip replaces file.txt with file.txt.gz — a compressed version of the same file. To recover the original, run `gunzip file.txt.gz`. Unlike ZIP, gzip does not bundle multiple files — it compresses exactly one file. For compressing multiple files together, gzip is paired with TAR: `tar -czf archive.tar.gz folder/`. Gzip achieves good compression ratios quickly and uses very little memory, making it ideal for server-side compression, log files, and data pipelines.

GZ pros and cons

Advantages

  • Extremely fast compression and decompression
  • Very low memory usage — suitable for embedded systems and streaming
  • Universal support on Linux, macOS, and modern Windows
  • HTTP/1.1 and HTTP/2 standard for web content-encoding (gzip saves 60–80% on text)
  • Mature, battle-tested format with no patent issues

Limitations

  • Compresses only one file at a time (pair with TAR for directories)
  • Worse compression ratio than bzip2, xz, zstd, or Brotli for the same data
  • Not suitable as a standalone archive format (no file listing, no metadata)
  • No built-in integrity verification beyond a CRC32 checksum
  • Replaced by zstd and Brotli in many modern use cases

When should you convert GZ files?

Use gzip (.gz) for compressing log files, individual data files in pipelines, and in combination with TAR (.tar.gz) for software distribution and backups. Consider switching to zstd for faster compression with better ratios, or Brotli for web content where browser support exists. Decompress .gz files with `gunzip` or `gzip -d`; most archive managers also handle .gz directly.

All FormatDrop conversions run entirely in your browser — no file upload, no server processing. Your files stay on your device.

GZ FAQ

How do I compress and decompress .gz files?
Compress: `gzip file.txt` → creates file.txt.gz and removes original. To keep original: `gzip -k file.txt`. Decompress: `gunzip file.txt.gz` → restores file.txt. Or: `gzip -d file.txt.gz`. To decompress without removing the .gz: `gzip -dk file.txt.gz`. For .tar.gz archives: `tar -xzf archive.tar.gz` extracts everything.
How does gzip work with web servers?
Web servers (Apache, Nginx, Caddy) compress text responses (HTML, CSS, JavaScript, JSON, XML) with gzip before sending them to browsers. Browsers advertise gzip support via the `Accept-Encoding: gzip` header. Gzip reduces text file sizes by 60–80%, significantly speeding up page loads. This is separate from .gz files on disk — it's on-the-fly compression of HTTP responses.
Is gzip the same as ZIP?
No — gzip and ZIP are different formats. ZIP is an archive format that bundles and compresses multiple files (each independently). Gzip compresses a single file using a stream-based algorithm. Both use DEFLATE compression internally, but in different ways. A .tar.gz file is a TAR archive (multiple files bundled) compressed with gzip as one stream — this achieves better compression than ZIP for many files.