Gzip Compress / Decompress
Compress or decompress text with Gzip — shows compression ratio
How to Use the Gzip Compress / Decompress
- Choose Compress or Decompress mode.
- Enter text (compress) or Base64-encoded gzip data (decompress).
- Click the action button.
- Copy or download the result.
Powered by pako.js. All processing is client-side.
What is Gzip Compression & Decompression?
The Gzip Tool allows developers to compress text into Gzip/Deflate byte formats and decompress `.gz` data back into readable text directly in the browser. Using the native Web Streams API and `CompressionStream`, it demonstrates how HTTP content encoding shrinks payloads and accelerates internet data delivery.
Common Uses
- Inspecting and decompressing raw `Content-Encoding: gzip` HTTP network payloads
- Testing Gzip and Deflate compression efficiency on JSON and HTML payloads
- Debugging microservice compression pipelines and binary log archives
- Decompressing small `.gz` configuration and archive files on Chromebooks and mobile devices
Frequently Asked Questions
What is the difference between Gzip and Deflate?
Both algorithms use the same core LZ77 and Huffman coding compression engine. Gzip wraps the compressed Deflate data with an 18-byte header, timestamp, and CRC32 checksum for file integrity verification.
How does HTTP Gzip compression improve web performance?
Gzip typically compresses text-based assets (HTML, CSS, JavaScript, JSON) by 60% to 80%, substantially reducing page load times and mobile data consumption.
Does browser Gzip compression match the standard command-line gzip utility?
Yes. Outputs produced by the standard Web `CompressionStream` API are 100% compliant with RFC 1952 and can be decompressed with standard Linux `gzip -d`.
Notes from this implementation
Compress the bytes, then recognize the header
Gzip output starts with the bytes 1f 8b. The page compresses the text you give it and can inflate a gzip blob you paste back, typically as Base64 so it can sit in a text box. A file that is already a .gz should be inflated, not compressed again. Double compression still ends in 1f 8b, and the inner payload is another gzip stream, which surprises people who inflate once and see binary.
Compression is not encryption. The plaintext length leaks, and a small message compresses to something an observer can often guess. Do not ship secrets as “it was gzipped.” The checksum tool can hash the compressed bytes if you need a fingerprint of the blob.