Skip to main content

Gzip/Zlib/Deflate Tester

Compress text with gzip, zlib (deflate with header), or raw deflate, and view compression stats — or decompress base64/hex encoded compressed data back to text. Runs entirely in your browser.

Input

Output

Output
Compression Stats
PropertyValue
No data yet
Was this helpful?

Guides

What this tool does

This tool lets you compress text using the three most common DEFLATE-based wire formats — gzip, zlib, and raw deflate — and inspect the result: compressed size, compression ratio, space savings, and the compressed data's header bytes. It also works in reverse: paste base64 or hex encoded compressed data and decompress it back to the original text.

All three formats wrap the same underlying DEFLATE algorithm, differently:

  • Gzip adds a 10-byte header (magic bytes 1f 8b) plus a CRC32 checksum and length trailer — the format used by .gz files and HTTP Content-Encoding: gzip.
  • Zlib (sometimes just called "deflate" in the browser CompressionStream API) adds a 2-byte header (78 01/78 9c/78 da/78 5e, depending on compression level) plus an Adler-32 checksum — used by PNG, PDF streams, and Git object storage.
  • Raw deflate has no header or checksum at all — just the compressed bit stream — used where the wrapping format already tracks length and integrity, like ZIP entries.

How to use it

  1. Paste or type text into Input Data (or click "Try an example").
  2. Set Mode to Compress.
  3. Choose a Format (Gzip, Zlib, or Raw Deflate) and an Output Encoding (Base64 or Hex).
  4. The compressed Output and the Compression Stats table update automatically.

To reverse the process, switch Mode to Decompress, paste base64 or hex encoded compressed data into Input Data, and pick the matching Format — or leave it on Auto-detect, which sniffs the data's magic bytes (gzip's 1f 8b, zlib's 78 xx) and falls back through the other formats if the first guess doesn't parse.

Why compression ratios can exceed 100%

Short inputs often grow when compressed — a compression ratio above 100% (negative "space savings") isn't a bug. Every compressed format spends a fixed number of bytes on headers and checksums, and DEFLATE's Huffman/LZ77 encoding needs enough repeated structure in the input to pay that overhead back. A one-line test string is exactly the case where gzip's 18 bytes of header+trailer overhead can outweigh what LZ77 manages to compress away. Compression ratios improve substantially on longer, more repetitive input.

Decompression errors

If the pasted data doesn't match the selected format (wrong format chosen, corrupted data, or an encoding mismatch between base64 and hex), the tool reports a clear error message in the Output box instead of failing silently — it never crashes on bad input.

Privacy

This tool runs entirely in your browser using a pure-JavaScript zlib implementation. Your text and files are never uploaded to a server.

gzipzlibdeflatecompressiondecompressionpako

Love the tools? Lose the ads.

One payment clears every ad from your account, for good. No subscription, no tracking.