How to decompress gzip online
Gzip is a common way to shrink data before it is stored or sent. When it shows up outside a terminal, it is often a long string that begins with H4sI. That is the Base64 form of the two bytes 1f 8b, which start every gzip file. To decompress gzip online, paste the string, and the tool does the rest.
Press Sample to try it. The sample string starts like this:
H4sIAAAAAAACAz3MsQrCMBSF4d2nCGdOpQ1O3dTB...It is 152 bytes of gzip data. Decompressed it becomes a 169-byte JSON text, and the strip reports gzip, a CRC-32 that matches and the type JSON data. A short text gains little from gzip, which is why the numbers are close. Larger text usually shrinks far more.
Decompress a gzip string from Base64 or hex
Compressed data is binary, so it travels as text in logs, API responses, queue messages and config files, usually as Base64. The reader accepts the plain and the URL-safe alphabet, a data:application/gzip;base64, prefix, text wrapped over several lines, text in quotes, padding that was cut off, and the literal backslash-n sequences you get when a string was copied from JSON.
Hex works too, in the forms people actually paste: continuous 1f8b0800, spaced bytes, 0x1f, 0x8b lists and dumps with colons. Auto detection chooses hex when the text starts with the gzip or zlib signature. Otherwise it reads Base64. If your hex starts differently, for example raw deflate, set Input is to Hex.
The same job in code takes one line in most languages:
import base64, gzip
text = gzip.decompress(base64.b64decode(s)).decode("utf-8")const text = require("zlib").gunzipSync(Buffer.from(s, "base64")).toString("utf8");Gzip, zlib and deflate: how the format is detected
Three names are used for closely related data. They all hold the same deflate compression, but each wraps it differently.
- gzip starts with 1f 8b, then a header that can hold a file name and a time, and ends with a CRC-32 and the original size.
- zlib starts with a two-byte header such as 78 9c and ends with an Adler-32 checksum. PNG files, Git objects and many libraries use it.
- Raw deflate has no header and no checksum. ZIP files and some network protocols use it.
In Detect mode the first bytes decide between gzip and zlib. Data with neither signature is tried as raw deflate, but the result is accepted only when it looks like text or a known file type, so random bytes are not shown as if they were a result. Pick Raw deflate by hand to skip that check.
Open a .gz file without a terminal
Not every system opens .gz files without extra software. Drop the file on the left box or press Upload, and the content appears on the right. Download saves it under the name stored in the gzip header when there is one, or under the .gz name without the extension.
- A .tar.gz file gives you the .tar file. This tool does not unpack tar, so extract it with an archive program afterwards.
- A text file that holds Base64 or hex, such as .txt or .b64, is read as text, not as a binary file.
- A file with several gzip members joined together, which logrotate and some tools produce, is read as one stream and the members are joined.
Files up to 50 MB are accepted, and the decompressed result may be up to 100 MB. For larger files use gunzip on the command line.
What the summary strip tells you
- Format and Read from: which compression was found and how the input was read, such as Base64 or hex.
- Compressed, Decompressed and Ratio: the sizes in bytes and how much the data grew when unpacked.
- Checksum: gzip carries a CRC-32 and zlib an Adler-32. A match is a good sign that nothing was damaged. A mismatch is shown in red, because the data may have been altered or cut. The check runs for single-member gzip files and zlib data.
- File name, Modified and Made on: fields from the gzip header. Many tools leave them empty, and some write a zero time, which is not shown.
Text is shown when the result is valid UTF-8. Bytes that are not valid UTF-8 appear as replacement characters in the preview, but Download keeps the original bytes.
When decompression fails
The message says what was found instead. If the first bytes are 50 4b, the data is a ZIP file, which this tool does not open. A PNG, a PDF or another known type is named the same way. Plain text that was encoded as Base64 is called out as plain text. Brotli data, which some servers send as Content-Encoding: br, is not supported and will be reported as unreadable.
The most common real problem is cut-off data: a log line truncated at a length limit, or a copy that missed the end of the string. The message then says that the compressed data ends too early. Copy the full string again.
Privacy
Compressed payloads often hold logs, tokens and customer data. The data is decompressed in your browser and is not uploaded. The Privacy Policy explains what the site stores.
To go the other way, use Gzip Compress. For plain Base64 text, try Base64 Decode, for files Base64 to File, and for hex text Hex to Text.