Skip to content

Gzip Decompress Online

Decode gzip to text (gunzip online): paste Base64 (H4sI…) or hex, or open a .gz file, and see the original content. Zlib works too, and Compress turns text into gzip.

Runs in your browser Free, no sign-up
Loading tool workspace...

What is gzip decompression?

Gzip is the compression format behind most of the web: servers send pages and API responses with Content-Encoding: gzip, log files are rotated into .gz archives, and many systems store payloads as Base64-encoded gzip, strings that start with H4sI. Decompressing (or decoding) gzip turns that compressed data back into the original text or file.

This gzip decompressor works in your browser. Paste gzip data as Base64 or hex, or open a .gz file, and the original content appears straight away, with JSON shown as a tree you can explore. It also recognizes zlib data, which is often mislabeled as gzip, and it can go the other way: switch to Compress to turn text or a file into gzip. Nothing is uploaded, so it is safe for API keys, logs and customer data.

How to decompress gzip online

  1. Leave Decompress selected (it is when the page opens) and paste the gzip data: Base64 starting with H4sI, Base64url, hex starting with 1f8b (spaces and line breaks are fine) or a data: URL. To decode a gzip file, click Open .gz file or drop it onto the tool.
  2. The decoded text appears in the output panel at once. JSON is shown as a tree you can expand, collapse and search with Ctrl+F; switch to Raw for the plain text.
  3. Read the line under the panels: the format (gzip or zlib), the size before and after and, when the gzip header has them, the original file name and date.
  4. Click Copy to copy the text, or Save to download the decompressed file under its original name.

Load Sample fills in a real gzip payload, a small JSON API response whose header carries the file name api-response.json, so you can see every part of the result before using your own data.

Gzip decode example

This Base64 string is a complete gzip stream. Paste it into the tool:

H4sIAAAAAAACAwXBwQ2AIBAEwFbWv/gyFqAfC9ACCKxCBI54JBqrd2ZlSoLjloxFPPdSrbs6bCEqGt+GxyrOL1bjJNebqvQ9WmDBbJXTaFicePrhB48k9/JKAAAA

The same 93 bytes written as hex, which the tool accepts just as well:

1f 8b 08 00 00 00 00 00 02 03 05 c1 c1 0d 80 20
10 04 c0 56 d6 bf f8 32 16 a0 1f 0b d0 02 08 ac
42 04 8e 78 24 1a ab 77 66 65 4a 82 e3 96 8c 45
3c f7 52 ad bb 3a 6c 21 2a 1a df 86 c7 2a ce 2f
56 e3 24 d7 9b aa f4 3d 5a 60 c1 6c 95 d3 68 58
9c 78 fa e1 07 8f 24 f7 f2 4a 00 00 00

Both decompress to this text:

Hello from CodeUnpack! This text was gzip-compressed, then Base64-encoded.

The gzip version (93 bytes) is larger than the 74-byte text it holds. Gzip adds 18 bytes of header and checksum, and a single short sentence has too little repetition to compress, so tiny inputs grow. Logs, JSON and HTML usually shrink by 70 to 90 percent.

Reading the gzip header

The first ten bytes are the header and the last eight are the trailer, so the example breaks down like this:

BytesMeaning
1f 8bThe gzip signature (magic bytes). Together with the next byte they Base64-encode as H4sI, which is why gzip strings start that way.
08Compression method: deflate, the only one in use.
00Flags: no file name, comment or extra field is stored.
00 00 00 00Modification time: not set. When a gzip file stores one, the tool shows it as the date.
02Extra flags: compressed at the maximum level.
03The operating system that made it: Unix.
05 c1 … e1 07The deflate-compressed data.
8f 24 f7 f2 4a 00 00 00A CRC-32 checksum of the original data, and its size (74 bytes), both checked during decompression so a damaged stream is reported instead of decoded wrongly.

How to recognize gzip data

Compressed data is easy to spot by how it starts. The tool reads these beginnings to decide how to decode what you paste, so you don't have to choose a format.

Starts withWhat it isWhere you see it
H4sIGzip, Base64-encodedAPI fields, database columns, cookies, message queues, config values
H4sI with - or _Gzip, Base64url-encodedURLs, tokens and cookies, where + and / aren't allowed
1f 8b or 1f8bGzip bytes written as hexHex dumps, xxd output, packet captures, debuggers
data:application/gzip;base64,A data: URL holding gzipBrowser tools and HTML
A .gz, .gzip or .tgz fileA gzip fileRotated logs (access.log.1.gz), database dumps, downloads and archives
eJw, eAE or eNoZlib, Base64-encodedPython's zlib.compress and Node's deflateSync output, often stored as if it were gzip
78 9c, 78 01 or 78 daZlib bytes written as hexThe same, in a hex dump

If your data starts some other way, it probably isn't compressed. Plain Base64 decodes with the Base64 Decoder, and the Instant Dev Decoder works out the format for you.

Features

  • Decompress gzip from Base64, Base64url, hex or data: URLs
  • Open or drag and drop .gz files, and save the decompressed file
  • Also decodes zlib / deflate data (eJw… / 789c…)
  • Shows the original file name and date from the gzip header
  • JSON output shown as a searchable tree
  • Binary content shown as a hex preview, with Save to download it
  • Compress text or any file to gzip as Base64, or save it as .gz
  • Protected against zip bombs with a 100 MB output limit
  • 100% client-side: private and works offline

What you can do with this gzip to text converter

  • Read Base64 gzip payloads. Decode the H4sI… values stored in databases, cookies, JWT claims and message queues to see what they hold.
  • Open .gz files without installing anything. Read a compressed log or JSON export, and save the decompressed file under its original name.
  • Debug compressed HTTP traffic. Paste a gzip response body copied from logs or a proxy and read it as text. To see whether a server compresses its responses, look for Content-Encoding in the HTTP Header Checker.
  • Decode zlib from code. Data made by Python's zlib or Node's deflate is recognized from its header and decoded the same way.
  • Inspect JSON inside gzip. Decompressed JSON opens as a tree; send it to the JSON Formatter to indent, sort or validate it.
  • Create gzip test data. Compress text to Base64 gzip for fixtures, config values and API requests.

Compress text to gzip

Choose Compress, then type or paste text, or open any file. The output is gzip as Base64, starting with H4sI, ready to paste into a header, a config value or a database field; Save downloads it as a .gz file instead. The line under the panels shows the size before and after and how much smaller it got. To compare how well different content compresses, use the Gzip Compression Checker.

Decompress gzip in code and on the command line

Each of these turns a Base64 gzip string (here in the variable or argument b64) back into text:

WhereCode
Linux / macOS terminalecho 'H4sI…' | base64 --decode | gunzip
A .gz filegunzip -k access.log.gz (-k keeps the .gz), or zcat access.log.gz to print it
Node.jszlib.gunzipSync(Buffer.from(b64, "base64")).toString("utf8")
Pythongzip.decompress(base64.b64decode(b64)).decode("utf-8")
PHPgzdecode(base64_decode($b64))
Browser JavaScriptawait new Response(new Blob([Uint8Array.from(atob(b64), c => c.charCodeAt(0))]).stream().pipeThrough(new DecompressionStream("gzip"))).text()

For zlib data, use zlib.inflateSync in Node.js, zlib.decompress in Python, gzuncompress in PHP and "deflate" instead of "gzip" in the browser.

Technical details

Decompression uses the browser's built-in DecompressionStream, so it is fast and the data never leaves your device. The format is detected from the first bytes: 1f 8b for gzip (RFC 1952) and a valid zlib header such as 78 9c for zlib (RFC 1950). Base64 may be standard or URL-safe, with or without padding and line breaks; hex may include spaces, line breaks, colons or a 0x prefix.

Output is streamed and capped at 100.0 MB, so a small, highly compressed "zip bomb" can't freeze the page. Content that isn't valid UTF-8 text, such as the tar archive inside a .tar.gz, is shown as a hex preview and can be saved as a file. Files made by joining several gzip members end to end aren't supported.

Compression uses CompressionStream at its standard level and produces an ordinary gzip stream that gunzip, Python, Node.js or any other gzip decoder can read. Text is encoded as UTF-8 first, and the header stores no file name.

Not sure what a string is? The Instant Dev Decoder detects Base64, URL encoding, JWT, gzip and more. Plain Base64 decodes with the Base64 Encoder & Decoder, and the File to Base64 Converter turns Base64 back into a downloadable file. Format decompressed JSON with the JSON Formatter, measure compression ratios with the Gzip Compression Checker, and check a server's Content-Encoding header with the HTTP Header Checker.

Frequently asked questions

How do I decode gzip to text?

Paste the gzip data into the input panel: as Base64 it usually starts with H4sI, and as hex with 1f8b. The tool detects the format and shows the decompressed text straight away; copy it, or save it as a file. To decode a gzip file, open or drop the .gz file instead.

My Base64 decodes to garbled characters. Is it gzip?

Possibly. If a Base64 decoder shows unreadable binary and the string starts with H4sI, the data is gzip-compressed; if it starts with eJ, it is zlib-compressed. Paste the original string here and it is decompressed to text. If it does not start with either, it may be an image, a PDF or encrypted data rather than compressed text.

What does H4sI mean at the start of a string?

H4sI is how the gzip header bytes 1f 8b 08 look when Base64 encoded. Any string starting with H4sI is almost certainly gzip-compressed data in Base64, and this tool can decompress it.

How do I decompress a .gz file online?

Click Open .gz file, or drag the file onto the tool. The contents appear immediately, and Save downloads the decompressed file with its original name. Nothing is uploaded; the file is read and decompressed in your browser.

Is this a gz file opener or viewer?

Yes. Open or drop a .gz file, including log.gz, csv.gz, json.gz and sql.gz files, and the decompressed contents appear straight away: text as text, JSON as a searchable tree, and binary data as a hex preview. Output is limited to 100 MB, and the file is read in your browser, so nothing is uploaded and nothing needs installing.

Why did my .gz file disappear after I ran gunzip?

gunzip (the same as gzip -d) replaces the .gz file with the decompressed file. To keep the original, use gunzip -k file.gz or gzip -dk file.gz. To read the contents without writing anything, use zcat file.gz, or open the file here, which never changes it.

How do I decompress a gzip string in JavaScript?

In Node.js: zlib.gunzipSync(Buffer.from(b64, "base64")).toString("utf8"). In the browser, turn the Base64 into bytes with Uint8Array.from(atob(b64), c => c.charCodeAt(0)) and run await new Response(new Blob([bytes]).stream().pipeThrough(new DecompressionStream("gzip"))).text(). This tool uses the same browser API.

How do I decompress gzip Base64 in Java, C# or PowerShell?

Java: new GZIPInputStream(new ByteArrayInputStream(Base64.getDecoder().decode(b64))).readAllBytes(). C#: new GZipStream(new MemoryStream(Convert.FromBase64String(b64)), CompressionMode.Decompress), read through a StreamReader. PowerShell: wrap [Convert]::FromBase64String($b64) in a MemoryStream, pass it to System.IO.Compression.GZipStream with Decompress, then read it with a StreamReader.

How do I decompress gzip Base64 in Azure Data Explorer (KQL)?

Use gzip_decompress_from_base64_string("H4sI…"), which Base64-decodes the value, decompresses it and returns the original UTF-8 string, or an empty result if the input is not valid gzip Base64. To check a single value quickly, or to see why it fails, paste it here.

How do I gzip a string to Base64?

Choose Compress and paste the text; the gzip output appears as Base64 starting with H4sI. In code: zlib.gzipSync(text).toString("base64") in Node.js, base64.b64encode(gzip.compress(text.encode())).decode() in Python, or echo -n 'text' | gzip | base64 -w 0 on Linux.

Why is the compressed output larger than the input?

Gzip adds 18 bytes of header and checksum, and compression needs repeated content to work with, so very short strings and data that is already compressed, such as images, video and ZIP files, can come out larger. Longer text such as JSON, HTML, CSV and logs usually shrinks a lot.

Will the output match the gzip command byte for byte?

Not necessarily. The compression level, header timestamp and operating-system byte differ between gzip implementations, so the bytes can differ, but every gzip decoder restores exactly the same original data.

Can it open .tar.gz or .tgz files?

It removes the gzip layer and gives you the .tar archive inside, shown as a hex preview that you can save. Extracting the individual files from the tar archive needs an archive tool.

What is the difference between gzip, zlib and deflate?

All three use the same deflate compression. Gzip wraps it with a header (file name, date) and a CRC-32 checksum, and zlib uses a shorter header with an Adler-32 checksum. This tool detects gzip and zlib automatically from their headers.

How do I decompress zlib data online?

Paste the data as Base64 (it usually starts with eJ) or as hex (it starts with 78). The tool detects zlib from the header.

Why does it say the data is corrupted or truncated?

The compressed data is incomplete or was changed: for example, a Base64 string that was cut off, a binary file opened and saved as text, or extra characters added at the end. Copy the full value again and make sure nothing was trimmed.

Is there a size limit?

Decompressed output is limited to 100 MB, which also protects your browser from zip bombs (tiny files that expand to gigabytes).

Is my data uploaded?

No. Pasted data and opened files are compressed and decompressed by your browser's built-in CompressionStream and DecompressionStream, in this tab. Nothing is sent to a server or stored.

Does it work offline?

Yes. Once the page has loaded, compressing and decompressing keep working without an internet connection, because they run entirely in your browser.

More encoders & decoders tools

View all