Check Gzip Compression of a File or Base64 String – Free

Check gzip compression on a file or a Base64 payload. The tool looks for the gzip header, decompresses the data in your browser and reports the compressed and uncompressed sizes.

How to use the Check gzip compression tool

  1. Choose a file of up to 20 MiB under Gzip file (optional), or paste Base64 into Base64 gzip data if no file is selected.
  2. Select Check gzip. Select Example to test a ready-made 25-byte gzip stream.
  3. Look at the Result box. Valid data produces one line with the compressed and uncompressed byte counts.
  4. If an error message appears instead, the header was found but decompression failed. See the causes below.
  5. Select Copy to keep the verdict.

What the gzip check verifies

A gzip stream, defined in RFC 1952, has three parts: a header of at least 10 bytes, a body compressed with DEFLATE, and an 8-byte trailer with a CRC-32 of the original data and its length. The header always begins with the bytes 1F 8B, followed by 08 for DEFLATE.

The tool first tests those two magic bytes. If they are missing it answers No gzip header found and stops. Otherwise it hands everything to the browser's built-in gzip decompressor, which inflates the body and compares the checksum and length in the trailer with the data it produced. A pass means the stream is complete and undamaged, not just correctly labeled.

Example: check gzip compression of a Base64 string

The sample is the word Hello compressed with gzip and written as Base64. Decoded, it is 25 bytes: 10 header bytes, 7 bytes of DEFLATE data and the 8-byte trailer. Tiny inputs grow when gzipped because the fixed 18 bytes outweigh any saving.

A handy shortcut follows from the header: the first three bytes are 1F 8B 08, so gzip data written as Base64 starts with H4sI.

H4sIAAAAAAAAA/NIzcnJBwCCidH3BQAAAA==
→  Valid gzip · 25 compressed bytes, 5 uncompressed bytes

Accepted input and limits

You can test data as a file on disk or as a Base64 field copied from a log, an API response or a database column. The tool reports sizes only. To see the decompressed content, use the Gzip compress / decompress tool on this site.

  • A file with any name or extension, up to 20 MiB. If a file is chosen, the text box is ignored.
  • Standard or URL-safe Base64. Whitespace and missing padding are fine.
  • A data URL. Everything up to and including base64, is removed first.
  • Up to 40 MiB of decompressed data. Past that, the check stops with The result exceeds the 40 MiB limit.

Why a gzip check fails

When the header is present but the data cannot be decompressed, the status line shows the error raised by your browser's decompressor. The wording differs between browsers. In Chrome the common cases look like this.

  • Compressed input was truncated: the stream ends early, often from an interrupted download or a cut-off Base64 string.
  • Incorrect data check or incorrect length check: the CRC-32 or the size stored in the trailer does not match, so bytes were altered.
  • Junk found after end of compressed data: extra bytes follow the trailer. Files made by concatenating several gzip members also trigger this.
  • No gzip header found: the data is something else, such as zlib, a ZIP archive (starts with 50 4B) or plain text.
  • Enter valid Base64 or choose a file: the text box is empty or is not Base64.

Frequently asked questions

How can I tell if a file is gzip compressed?

Look at the first two bytes. Gzip data always starts with 1F 8B in hex. This tool checks that signature and then decompresses the data to confirm it is intact, which a file extension cannot tell you.

Does this check whether my web server uses gzip?

No. It inspects data you provide and does not make HTTP requests. To test a server, open your browser's developer tools and look for Content-Encoding: gzip among the response headers of the request.

Why does valid zlib or ZIP data fail the check?

They are different containers around the same DEFLATE algorithm. Zlib uses a 2-byte header and an Adler-32 checksum, and ZIP is an archive format. Only the gzip framing from RFC 1952 passes this test.

Is the file sent to a server for testing?

No. The file is read with the browser's File API and decompressed by the browser's own DecompressionStream. Nothing is uploaded.

Related tools