Gzip Compress and Decompress
Compress text with gzip, zlib or raw deflate and see the ratio, or decompress Base64-encoded compressed data back to text, using the browser's CompressionStream.
Free · No sign-up · Your inputs stay in your browser
Input
Gzip or deflate text
Output
Base64 of the compressed bytes
Uses the browser's CompressionStream. gzip is what Content-Encoding: gzip and .gz files carry; 'deflate' in HTTP actually means zlib, and PHP's gzdeflate() writes raw deflate, gzcompress() zlib and gzencode() gzip. Repetitive text like JSON logs shrinks most.
Runs in this browser. Nothing you paste is sent to a server.
About this tool
Method, assumptions, practical next steps, and limits.
Three wrappers, one algorithm
All three use the DEFLATE algorithm of RFC 1951. Raw deflate is the bare stream; zlib (RFC 1950) adds a two-byte header and an Adler-32 checksum; gzip (RFC 1952) adds a longer header and a CRC-32. HTTP's Content-Encoding: deflate means zlib, despite the name.
PHP's three functions
gzdeflate() writes raw deflate, gzcompress() zlib and gzencode() gzip, with gzinflate(), gzuncompress() and gzdecode() to reverse them. Data compressed by one cannot be read by the wrong inverse, which is the usual reason decompression fails.