Bug Days
Developer guide

Decode Base64 GZip to JSON: A Worked Example

Decode a Base64 GZip string into readable JSON, understand the H4sI prefix, and share a working example that opens directly in the browser tool.

· Updated 6 minute read Payload decoding
GZip Base64 decoder with a compressed sample and its readable JSON output

You copy a value from an API response or log, paste it into a Base64 decoder, and get unreadable characters. The value may be Base64-encoded compressed data, not Base64-encoded text. If the sender used GZip, there is one more step before you can read it.

The decoding order: Base64 string → compressed bytes → GZip decompression → UTF-8 text. Parse or format the JSON only after those steps.

A complete Base64 GZip example

This small order-status message is synthetic. The link opens the GZip Base64 decoder with the input and decompression action already selected, so you can compare the result without assembling a test yourself.

Base64-encoded GZip input

H4sIAAAAAAAAE6tWyi9KSS3yTFGyUkpJzc3XNTQwMVLSUSouSSwpLVayUirOyCwoSE1R0lHKLEnNLVayMq4FAP2vpxk0AAAA

Expected decoded text

{"orderId":"demo-1042","status":"shipped","items":3}

Open this decoding example → Try the reverse: compress this text →

These links carry the synthetic sample and operation in the URL. They do not depend on a 30-day stored short link.

Decode your own payload in the browser

  1. Copy the complete Base64 string. A quoted JSON string is accepted, but the key, comma, or entire response object is not part of the encoded value.
  2. Open the decoder and replace Input with that value.
  3. Select Decode & Decompress.
  4. Compare Output with what the producer says it sent. Use Copy Output, Download output, or Inspect in JSON Formatter to continue with the JSON formatter. The JSON handoff keeps the raw text for inspection rather than automatically parsing and rewriting numeric IDs or duplicate keys.

Decompression does not guarantee JSON. The producer might have compressed XML, a log line, or another text format. The tool displays decoded text as supplied; it does not silently rename fields, reorder properties, or pretty-print the payload.

Open a .gz file, Base64URL value, or hex dump

If the evidence is a file rather than an API field, select Open file or drop a .gz file into the input panel. The browser reads its compressed bytes locally, displays an equivalent Base64 value, and decompresses it. No file upload or local bridge is needed. Download output saves the decompressed bytes; Download .gz saves the compressed stream.

Auto input also accepts URL-safe Base64 using - and _, omitted = padding, and deliberate line wrapping. For a hex dump beginning with 1f8b, leave Auto selected; otherwise choose Hex. The tool never guesses that a space was originally a plus sign. If transport damaged a value, return to the source.

Binary or non-UTF-8 results are offered as a .bin download instead of being displayed with replacement characters. A .tar.gz becomes a tar file after GZip decompression, not an extracted folder: use an archive utility for that final step.

Check the sizes before copying the result

The result separates original bytes, compressed GZip bytes, and final Base64 size. Base64's transport overhead is not included in the GZip saving percentage. A short message can grow even when the compression is working correctly. When creating a payload, level 1 favors speed, level 6 is the balanced default, and level 9 spends more work on compression.

Conversions run in a background worker. The page accepts up to 3 MiB of encoded input, 2 MiB of compressed data or text to compress, and 8 MiB of decompressed output. It stops after 8 seconds or at the output limit, keeping no partial success. Reduce a large capture to a representative message or use the local script recipes for larger jobs.

What does the H4sI prefix tell you?

A usual GZip stream begins with the bytes 1f 8b 08: two identifying bytes followed by the DEFLATE compression-method byte. Their Base64 representation is H4sI. That makes the prefix a useful clue when examining a captured string. The header layout is defined in RFC 1952.

A matching prefix is not an integrity check. A truncated copy can retain its first four characters and still fail to decompress. If the example above works but your payload does not, follow the Base64 GZip troubleshooting guide.

GZip and Base64 do different jobs

GZip is the compression layer. Base64 makes its binary result convenient to carry inside a text field. Neither step is encryption. The standard Base64 representation uses printable characters and may end with = padding; see RFC 4648.

“Base64 GZip” describes the payload, but is an ambiguous instruction for creating one. To produce the format used here, start with text, encode it as UTF-8, compress those bytes with GZip, and Base64-encode the compressed result. The reverse-example link above follows that order.

Share an example someone else can reproduce

A useful question includes the encoded value, the result you expected, and the operation that failed. Add a runnable link beside that explanation so a reader can try it immediately. The text should remain understandable even without following the link.

  1. Replace customer values or credentials with a small synthetic message before compressing it.
  2. Run the operation in Bug Days, then select Share.
  3. Choose the embedded-data link for an example that should not depend on short-link storage. Copy the link offered by the Share dialog.

Embedded links contain the sample itself; anyone with the link can read it. The separate short-link option stores a sample for 30 days. The worked examples on this page use embedded links, with no stored short-link record.

When to use a script instead

The browser is convenient for checking one message. For a repeated job, move the same steps into your application or a local script. Our Python and Node.js recipes use the standard libraries and include a Unicode example to catch character-encoding mistakes.

Continue reading