Loading GZIP Checker...
Please wait a moment

How to Check a GZIP File

A .gz file carries more than compressed bytes. Its header can hold the original name, a timestamp and the OS it was made on, and its trailer holds a checksum and the original size. This page reads all of it and tells you whether the file is intact.

Step 1

Upload a .gz file or paste Base64

Upload the GZIP file you want to check, or paste it as Base64:

•
Upload from your computer: click "Upload" and pick a .gz, .gzip or .tgz file. The raw bytes are read as they are.
•
Paste Base64: line-wrapped, URL-safe, quoted and data: URI forms are all accepted.
•
Try the Sample: it loads a small gzipped JSON file.

Example: the start of the Sample in Base64

GZIP in Base64 nearly always begins with "H4sI", the encoding of the magic bytes 1f 8b and method 8 described in RFC 1952:

H4sIAAAAAAAAA5WRT0sDMRDF7/0UQ86r7C4Wul7V7kVlsdWLlJDdna7B/ClJtlJKv7uTiBUp...
Step 2

Read the analysis

The check runs by itself about half a second after the input changes. Before "Valid GZIP" appears, the data has been fully decompressed and its CRC-32 and size trailer compared, so a file that only has the right first two bytes will not pass.

Example: what the Sample shows

GZIP data268 bytes
Original (decompressed)494 bytes
Compression ratio45.75% smaller
CRC-3255c9c0c3, matches the decompressed data
Modification timeNot set (0)
Extra flags (XFL)0: no hint
Operating systemUnix (3)

The Sample was made without a stored name or timestamp, which is why those fields are empty. A file made with gzip on the command line usually has both.

Step 3

Look at or save the content

•
Text content is shown in the lower panel, and "Copy" copies it.
•
Binary content (images, a .tar, other archives) is not previewed; the panel tells you its size instead.
•
Download saves the decompressed bytes exactly, using the file name stored in the header when there is one. To only unpack a file, GZIP Decompression does that with less detail.

Frequently Asked Questions

How do I check if a file is GZIP compressed?

Upload it with the "Upload" button, or paste its Base64 text. A GZIP file always starts with the bytes 1f 8b (in Base64, "H4sI"). If those are there, the page reads the whole file, decompresses it and compares the checksum before it shows "Valid GZIP". If they are not, it tells you what the data looks like instead: ZLIB, raw DEFLATE, ZIP, Zstandard, plain text and a few other formats are recognised.

What does the page read from a GZIP header?

Everything the format stores: the compression method, the flags, the modification time (shown in UTC), the XFL hint byte, the operating system byte, and, when present, the original file name, the comment, the extra field and the header checksum. From the 8-byte trailer it reads the CRC-32 and the original size, and checks both against what actually came out.

Can it tell me which compression level was used?

Not exactly, and neither can anything else. GZIP files do not store the level. There is one hint byte (XFL): 2 means the compressor used its slowest, best setting, 4 means its fastest, and 0 means no hint. Plenty of compressors write 0 whatever the level, so treat it as a hint only.

How is the compression ratio worked out?

It is 1 − (size of the GZIP data ÷ size of the original), where the original size is the number of bytes that really came out when decompressing. For the Sample, 268 bytes of GZIP hold 494 bytes of JSON, so it is 45.75% smaller. gzip -l leaves the 18 bytes of header and trailer out of its sum, so its figure can be a little different. Very small or already-compressed inputs often get bigger, and the page says so ("8.46% larger").

What do "cut off", "checksum doesn't match" and "extra bytes" mean?

Cut off means the data ends before the compressed stream or its trailer does, usually an interrupted download or a Base64 string that was not copied in full. A checksum mismatch means the bytes decompressed but do not match the CRC-32 or size stored in the file, so the content cannot be trusted. Extra bytes means something was appended after the GZIP data; gzip calls that trailing garbage. Zero bytes at the end are only padding and are accepted.

Does it handle files with several GZIP members?

Yes. Concatenated .gz files (for example cat a.gz b.gz > all.gz) are valid GZIP, and the page lists each member with its size and name. The preview and the download hold all members joined together, which is what gunzip gives you too.

Is my file uploaded anywhere?

No. The file is read and decompressed in your browser with the pako library. Nothing is sent to a server, and nothing is kept: reload the page and the editor starts empty. On the command line, gzip -t file.gz runs the same integrity test and gzip -lv file.gz prints sizes and the CRC.

Can this tool check TAR.GZ files?

It checks the GZIP layer: header, checksum, sizes and ratio. The TAR archive inside is binary, so the preview says so instead of showing garbled text, and Download saves the .tar exactly. To list and save the files inside, use the TAR.GZ Extractor.