Gzip decompress Base64 and hex strings
Compressed data often travels as text: API responses that embed gzipped JSON, message queue payloads, CloudWatch Logs subscription data, Helm release records stored in Kubernetes secrets, or database columns. The gzip decompress tool takes that text — Base64 or hex — unpacks the gzip stream and shows the original content.
Example
Gzip data (Base64):
H4sIAAAAAAAAA/NIzcnJVyjPL8pJUVTwwMUBAFSjmmImAAAADecompressed:
Hello world! Hello world! Hello world!
Recognising gzip data
- In Base64, gzip streams almost always start with
H4sI— the encoding of the magic bytes1F 8B 08. - In hex, they start with
1f8b. Auto-detect picks hex when the input consists only of hex digits and begins with1f8b. - URL-safe Base64 (
-and_), missing padding, line breaks and adata:URI prefix are all accepted.
What the gzip header tells you
The example above decodes to bytes that start 1f 8b 08 00 00 00 00 00 00 03. Those ten bytes are the gzip header:
1f 8b— the magic number.08— compression method DEFLATE, the only one in practical use.00— flags. A value of08would mean the original file name is stored after the header, asgzip file.txtdoes.00 00 00 00— modification time, here zero because the data was compressed in memory.00 03— extra flags and the operating system (3 = Unix).
The stream ends with an 8-byte trailer: a CRC-32 of the original data and its length modulo 2³², little-endian. In the example the last bytes are 26 00 00 00, which is 38, exactly the length of the decompressed text.
Troubleshooting
- “incorrect header check”. The data has neither a gzip nor a zlib header; zlib data (Base64 starting with
eJ, hex with78) is recognised and decompressed here too. It may be raw DEFLATE, which Zlib Decompress handles, or not compressed at all. - “unexpected end of file” or “invalid distance too far back”. The data is truncated or corrupted, often because a long string was cut off when copied.
- Garbled output. The decompressed content is binary (an image, a protobuf, another archive). Use the Download button to save it as a file.
- Double encoding. Some systems Base64-encode twice. If decoding gives another Base64 string, decompress or decode it again.
If the decompressed text is JSON, as with most API and log payloads, paste it into a JSON formatter next to make it readable.
Doing it in code
Shell: echo "H4sI…" | base64 -d | gunzip. Python: gzip.decompress(base64.b64decode(s)). Node.js: zlib.gunzipSync(Buffer.from(s, 'base64')).toString(). The tool is useful when you just want to peek at a value without writing a script.
Download the result
Besides the text view, the decompressed bytes can be saved with the Download button, which is useful for large outputs or binary content. The status bar reports the compressed and decompressed sizes so you can see the compression ratio.
Privacy
Decompression runs locally in your browser using a JavaScript implementation of zlib, and nothing is uploaded. Compress new data with Gzip Compress; if the input is plain Base64 without compression, the Base64 Decoder is the right tool.