Gzip compress / decompress
What is a Gzip Compress Decompress?
Gzip is the most widely used compression format on the web and in Unix tools. It powers HTTP Content-Encoding: gzip, .gz files and compressed payloads in many APIs, queues and logging systems. Because compressed data is binary, it is often transported as Base64 text. This tool compresses text to Base64-encoded gzip and decompresses it back.
How to use it
- To compress, paste text and copy the Base64 output.
- To decompress, paste Base64-encoded gzip data and read the original text.
Example
A repetitive JSON log of 2,000 bytes containing many similar records may compress to around 300 bytes, then about 400 Base64 characters. Gzip data always starts with the bytes 1F 8B, which appear as H4sI at the start of the Base64 string, a handy way to recognise it.
How well does gzip compress?
- Text, JSON, HTML, CSS and logs: often 60 to 90% smaller.
- Already compressed data (JPEG, PNG, MP4, ZIP): little or no gain, sometimes slightly larger.
- Very short strings: the gzip header adds about 18 bytes, so tiny inputs grow.
Related formats
- Deflate is the raw algorithm inside gzip; zlib is deflate with a small header and checksum.
- Brotli compresses web text 15 to 25% better than gzip and is supported by all modern browsers.
- Zstandard is faster with similar ratios and is popular for logs and databases.
Troubleshooting
If decompression fails, the data may be raw deflate or zlib rather than gzip, may be URL-safe Base64, or may have been truncated.
Frequently Asked Questions
How can I recognise gzip data in Base64?
Base64-encoded gzip usually starts with H4sI, which corresponds to the gzip magic bytes 1F 8B.
Why did my text get bigger after compression?
Very short inputs grow because gzip adds a header and checksum. Compression pays off on longer, repetitive text.
What is the difference between gzip, zlib and deflate?
Deflate is the compression algorithm. zlib and gzip wrap deflate data with different headers and checksums.
Is Brotli better than gzip?
For web text, Brotli usually compresses 15 to 25 percent better. Gzip remains the most widely supported.