Gzip Compress and Decompress

Compress text or a file with gzip or deflate and see exactly how much smaller it got.

Adds a short header and a CRC32 checksum. What .gz files and Content-Encoding: gzip use.

How it works

  1. 1Paste text or choose a file. It is compressed as you type and the real byte counts are shown.
  2. 2Pick gzip, zlib deflate or raw deflate — the three differ only in their header and checksum, and the wrong choice is the usual reason decompression fails.
  3. 3Compressed output is displayed as Base64 because the bytes are binary, but the size figures refer to the actual bytes.
  4. 4Switch to decompress and paste Base64 back in to recover the original.

Common questions

What is the difference between gzip, deflate and raw deflate?
The compression algorithm is identical — DEFLATE. gzip wraps it in a 10-byte header with a CRC32 checksum, which is what .gz files and Content-Encoding: gzip use. zlib deflate uses a 2-byte header and Adler-32. Raw deflate has no wrapper at all and is what lives inside a ZIP archive.
Why did my data get bigger?
Very short input has nothing to compress but still pays for the format header. Already-compressed data — a JPEG, a PNG, a ZIP — has had its repetition removed already, so gzip can only add overhead. That is expected, not a failure.
How much should I expect to save?
Text compresses extremely well: JSON, HTML, CSS and logs commonly drop by 70–90% because they are full of repeated structure. Images, video and archives barely move. If you are enabling gzip on a web server, the wins are all in the text assets.
Is this the same as a ZIP file?
No. A .gz holds a single compressed stream. A .zip is a container that can hold many files, each compressed separately, with a directory at the end. This tool produces the former.
Does it use a library?
No — it uses CompressionStream, which is built into the browser. That is also why there is no compression-level setting: the native API does not expose one.
Is my file uploaded?
No. Compression happens in your browser and nothing is transmitted.

Just need it as text, not smaller?

Base64 converts a file to text without compressing it — the right tool for carrying bytes through something that only accepts characters.

Open the Base64 converter

Related tools