b2KIT

Gzip Compress / Decompress

Compress files with gzip and decompress .gz files entirely in the browser.

Tested tool guide Tested browser tools Checked August 16, 2026

What Gzip Compress / Decompress does and how it behaves

Gzip Compress / Decompress creates a gzip stream from one selected file or expands a .gz stream back to its uncompressed bytes. It performs both directions locally in the browser and makes the resulting bytes available as a file. The common surprise is that gzip is not a multi-file archive format like ZIP. A gzip member represents a single byte stream. To compress several files or a directory together, package them first, commonly as a tar archive, and then compress that archive with gzip.

How the result is produced

1

Creating a gzip stream

During compression, the selected file is treated as one byte stream. Gzip places a DEFLATE-compressed representation inside a gzip member, with a header before it and a trailer after it. The trailer records a CRC-32 value and the original byte count modulo 2^32. These fields let a decoder detect many forms of damaged or incomplete gzip data.

2

Recovering the original bytes

During decompression, the gzip framing is removed and the DEFLATE payload is expanded to recover the original byte sequence. This is a format operation, so text encoding, table rows, image dimensions, and other content-specific structures are not interpreted. Processing occurs entirely in the browser, which is relevant for private database dumps or logs because the selected file is not uploaded.

Good uses

  • Compress a database export such as dump.sql before submitting it to a system whose documented input format is .gz.
  • Expand a downloaded access.log.gz file so its original log bytes can be opened by an editor or analysis program.
  • Create a gzipped CSV or JSON artifact for storage, transfer, or software that explicitly expects a gzip-wrapped file.

Limits and checks

  • Do not compare gzip files byte for byte to decide whether their uncompressed content matches. Header metadata and valid compression choices can differ, so identical input can produce different .gz bytes and slightly different compressed sizes.
  • A .gz file does not by itself preserve a directory tree or bundle several named files in the way a ZIP archive does. A filename ending in .tar.gz normally contains a tar archive that must also be unpacked after gzip decompression.
  • Compressed size does not indicate the eventual memory requirement. Highly repetitive input can produce a small .gz file that expands into a much larger result, and browser memory or available storage may limit whether that result can be completed or saved.

Common questions

Is a gzip file the same thing as a ZIP archive?

No. Both can reduce file size, but their container structures and expected uses differ. ZIP is designed to hold multiple entries with filenames and related metadata. Gzip compresses a byte stream and does not provide an equivalent directory-oriented archive structure. Renaming .gz to .zip, or the reverse, does not convert between the formats.

Why is the new .gz file different from one made elsewhere?

Gzip permits header fields such as a modification time, original filename, and operating-system identifier, while compression choices can also produce different valid DEFLATE representations. Consequently, two .gz files can have different hashes and sizes yet decompress to exactly the same bytes. Compare the recovered content when equivalence matters, not only the compressed files.

References and verification

The behavioral notes were checked against the browser implementation. Standards and primary references below define the relevant format, formula, or platform behavior.

Related Tools