piapia123
en

Gzip Compression and Decompression

Encoding

Everything runs locally in your browser — nothing is uploaded

Input
Drop a file here to load its contents
Output

Compress text to gzip, or decompress gzip back to text. One thing to get straight first: gzip is not encryption. It has no key, anyone can unpack it, and the output is merely not directly readable — a number of tool sites file it under "encryption", which is a historic misnomer. Its actual job is making data smaller: a JSON payload typically compresses to about a third, and logs, API responses and backups all rely on it. This tool uses the browser-native implementation, so results are byte-for-byte identical to the `gzip` command, to zlib and to standard libraries in every language, and are interchangeable with them. The output lists original size, compressed size and the ratio — and note that if the data grew, that is normal (short text plus a full gzip header does that), and the page says so explicitly.

Features

  • Both ways: text ⇄ gzip
  • Output as Base64 or hex; both are accepted on input (hex tolerates spaces, colons and line breaks)
  • Byte-for-byte identical to the gzip command, zlib and standard libraries — directly interchangeable
  • Reports original size, compressed size and the size ratio
  • Says why the data grew, so a bigger output does not look like a broken tool
  • For invalid input, points at truncation, stray line breaks, or a zlib / deflate payload

How to use

  1. Choose the direction: compress or decompress
  2. Choose the data format: Base64 or hex
  3. Paste your content and press Ctrl/⌘ + Enter, or click Run
  4. Copy the result — each row has its own copy button

FAQ

Can gzip be used for encryption?
No. gzip is compression, not encryption: there is no key, anyone can unpack it, and the data is merely not directly readable. Compressing sensitive content before sending it is no different from sending it plainly — every bit of information is still in that byte stream. For confidentiality, use AES, or any real cipher.
Why did the output get larger?
Because gzip carries fixed header and trailer overhead (about 18 bytes), and when the content is already short or already compressed (zip, images, video, streams inside PDFs) DEFLATE finds no repeated patterns worth encoding and has to spend extra bytes recording that it stored the block verbatim. That is normal for every compression algorithm, not a fault here. The rule is simple: compression only helps data that is redundant and has not been compressed already.
My data will not decompress — it says this is not valid gzip
First check whether the copy got truncated — compressed output contains binary bytes, and pasting into chat windows or forms often clips it or inserts line breaks. Then check the format: `zlib` (starting with 0x78), `raw deflate` (no header or trailer) and `gzip` (starting with 0x1f 0x8b) are three incompatible formats that all get called "compression" casually, and feeding zlib data to a gzip decoder must fail. This tool handles gzip only.
Is the output the same as the gzip command produces?
Exactly the same. The Base64 from `echo -n "content" | gzip -c | base64` matches this tool byte for byte, because both use standard DEFLATE with the gzip wrapper, and both write a zero timestamp into the gzip header — which is why identical input always produces identical output, safe to compare and to cache.

Related tools