Decodex

Decode a Base64 string starting with H4sI and decompress gzip

A successful Base64 decode can produce compressed data. Follow a 23-byte gzip member all the way back to the text OK and its final newline.

Reverse the operations in order

This sample started as UTF-8 text, was compressed with gzip, then encoded in Base64. Restore the bytes, decompress them and only then read the text. Switching character encodings while the payload is still compressed will not reveal the message.

Inspect the header and the actual result

Run the Python snippet. Its first line prints 1f8b08 23. The first two bytes identify gzip and 08 selects DEFLATE compression. The second line prints a byte string with OK followed by a single newline. Using repr makes that final byte visible.

import base64, gzip
value = "H4sIAAAAAAAC//P35gIAP2zfdwMAAAA="
packed = base64.b64decode(value, validate=True)
print(packed[:3].hex(), len(packed))
print(repr(gzip.decompress(packed)))

Identify which step failed

A matching header can survive truncation. If Base64 decoding succeeds but decompression fails, compare the transmitted length with the source. If you already have plain text after the first step, check whether the producer applied compression before attempting another transformation.

Open the file decoder

Related guides

References

More online tools

Convert images, test your keyboard, and use other handy tools in your browser.

Explore Altomono tools