Free GZ test files and sample generator

Gzip-compressed stream, common on Unix systems. Frequently wraps a tarball (.tar.gz) or single files.

Generate a .gz file →

What is a .gz file?

GZ: Gzip Compressed. Gzip compresses a single stream. It is not a multi-file archive. It is the compression behind HTTP Content-Encoding, log rotation and .tar.gz, so decompression behavior is worth testing on its own.

Why generate a test GZ file?

How a .gz file is identified

Every .gz file begins with 1F 8B 08, the gzip magic number and the deflate method. That is what a validator inspecting content rather than the file name looks for.

How the size lands on the exact byte

The gzip header can carry an optional null-terminated comment field of any length. Decompressors ignore it, so it takes the padding and the file still round-trips through gunzip.

Negative testing with broken GZ files

Which failure to reach for, and what to assert for each, is covered in how to make a corrupted file for testing. For upload limits and type checks see testing file upload validation.

Sample GZ content

[Compressed], gzip, deflate, from access.log

This shows the shape of the file. Your download is generated fresh at the size you choose, so the values will differ.

How to open and verify the file

Decompress with `gunzip file.gz` or `gzip -t file.gz` to test integrity.

Media type application/gzip · extension .gz · category Archives

Generate a .gz file → · questions about sizes, privacy or cost are answered on the site FAQ.

Frequently asked questions about GZ files

What identifies a .gz file?

A .gz file begins with the bytes 1F 8B 08, the gzip magic number and the deflate method. Those bytes are what a content-sniffing validator looks for, and what the Corrupted condition destroys.

How can a .gz file be an exact number of bytes?

The gzip header can carry an optional null-terminated comment field of any length. Decompressors ignore it, so it takes the padding and the file still round-trips through gunzip.

Can I download several broken GZ files at once?

Yes, select more than one File Condition and you get one ZIP containing a .gz per condition, each named after its condition.

Can the GZ file use UTF-16 or a byte-order mark?

No, and deliberately. A .gz file is a container rather than plain text, so rewriting its bytes as UTF-16 would not produce a UTF-16 document. It would produce a broken file. Use a text format such as CSV, JSON or XML for encoding tests.

How do I open or verify the GZ file?

Decompress with gunzip file.gz or gzip -t file.gz to test integrity.

Related Archives formats

ZIP · TAR · 7Z · RAR · JAR · WAR · ISO

Browse all file formats →