Gzip Compress / Decompress
Compress text to Gzip Base64 or decompress Gzip data back to text — runs entirely in your browser.
How Gzip compression works in a browser
Gzip uses the DEFLATE algorithm (LZ77 + Huffman coding) to find repeating patterns in data and represent them compactly. This tool uses the browser's native CompressionStream and DecompressionStream APIs (Chrome 80+, Firefox 113+, Safari 16.4+) — no libraries, no uploads. Compressed output is Base64-encoded so it can be safely pasted as text.
Built and maintained by Meet Shah · Last updated
What this tool is used for
- Checking how much smaller a payload becomes before deciding whether compressing it is worth the CPU.
- Decompressing a gzipped blob you pulled out of a log or a response body.
- Producing a compressed fixture to test a decompression path.
- Comparing the compressed size of two encodings of the same data.
- Confirming that a byte sequence really is gzip rather than another container.
Frequently Asked Questions
- What is the difference between gzip, DEFLATE and zlib?
- DEFLATE is the algorithm; zlib and gzip are two different containers around it. gzip adds a filename, timestamp and CRC32; zlib adds a smaller header and an Adler-32 checksum. Feeding one to a decoder expecting the other fails on the header.
- How well does it compress?
- Text typically shrinks 70-90%, since DEFLATE combines LZ77 back-references with Huffman coding and prose is highly repetitive. Already-compressed data — JPEG, PNG, MP4, zip — gains nothing and often grows slightly.
- Should I still use gzip for the web?
- Brotli beats it by roughly 15-20% on text and is supported everywhere modern, so prefer it when available. gzip remains the universal fallback, and serving both via content negotiation is standard practice.
- What is a zip bomb?
- A small archive that expands to an enormous size — 42.zip is 42KB and unpacks to 4.5PB through nested layers. Any service decompressing untrusted input must cap the output size rather than trusting the declared one.
- Is gzip the same as a .zip file?
- No. gzip compresses a single stream; ZIP is an archive format holding many files with a directory, and it happens to use DEFLATE for each. That is why .tar.gz exists — tar does the bundling, gzip the compressing.
- What are the compression levels actually trading?
- Level 1 is fast and leaves bytes on the table; level 9 spends substantially more CPU for a few percent more. For content compressed once and served many times, 9 is worth it; for per-request compression, the middle levels usually win.
- Why does compressing an already-compressed file make it bigger?
- Because JPEG, PNG, MP4 and zip archives have already removed the redundancy gzip looks for, so it finds nothing to shrink and adds its own header and checksum. Serving those with gzip costs CPU on both ends for no gain.
Common errors and gotchas
- Confusing gzip with raw deflate or zlib. They share the algorithm and differ in the header, so decoders are not interchangeable.
- Compressing already-compressed data such as a JPEG or a ZIP, which usually makes it slightly larger.
- Expecting a small input to shrink. Below a few hundred bytes the header often outweighs the savings.
- Treating compression as obfuscation. It is fully reversible with no key involved.
- Comparing compressed sizes across tools with different compression levels and reading the difference as a bug.
Related Encoders & Decoders tools
Base64 Encoder
Encode or decode Base64 strings.
URL Encoder
Safely encode or decode URL parameters.
Base Converter
Convert numbers between binary, octal, decimal, hex, and base 2-36.
ROT13 Encoder / Decoder
Apply the reversible ROT13 letter-substitution cipher.
HTML Entity Encoder / Decoder
Escape or unescape HTML entities like & and <.
Punycode Converter
Convert internationalized domains to and from Punycode.
Text to Morse Code
Translate text into Morse code dots and dashes.
Morse Code to Text
Decode Morse code dots and dashes back into text.