File Formats
  • Audio
  • Video
  • Images
  • 3D & CAD
  • Documents
  • Data
  • Code
  • System
Data
  • Structured text
  • Binary serialisation
  • Databases
  • Scientific
  • Geospatial
  • Machine learning
  • Messages & calendars
  • Compression
  • Archives
  1. Home
  2. Data
  3. Compression
  4. GZ
.GZ
  • Overview

.GZ

Gzip compressed file

Introduction

Gzip compresses a single file with the DEFLATE method. Jean-loup Gailly and Mark Adler wrote it for the GNU project in 1992, and the format is described in RFC 1952. It is the standard compressor on Unix systems and is also used to compress web pages in transit.

Gzip holds one file, so a folder is first bundled with tar and the tar file is then compressed. The result is named .tar.gz, or .tgz for short.

Software

  • GNU gzip (macOS, Linux, Windows)
  • 7-Zip (Windows)
  • WinRAR (Windows)
  • PeaZip (Windows, macOS, Linux)
  • Archive Utility, built into macOS
  • zlib, the library most programs use to read and write gzip

Structure

A gzip file is one or more members one after another; most files hold one. Numbers are little-endian.

  1. 0Magic 1F 8B2 bytes
  2. 2Method 8 for DEFLATE1 byte
  3. 3Flags which optional fields follow1 byte
  4. 4Modification time Unix seconds, or 04 bytes
  5. 8Extra flags and operating system2 bytes
  6. 10Optional fields extra data, original file name, comment, header CRCvaries
  7. …Compressed data a DEFLATE streamvaries
  8. …Trailer CRC-32 of the original data, then its size modulo 2328 bytes
One gzip member: header, DEFLATE data and trailer.

The flag bits are 1 for text, 2 for a header CRC, 4 for an extra field, 8 for a file name and 16 for a comment. The name and comment are zero-terminated Latin-1 text. Because the size in the trailer wraps at 4 GiB, it gives the true size only for smaller files.

© 2026 fileformats.org About Contact Made by Lewpen