GZIP Decompress Guide | Decompress .gz Files Online Free

All posts

Understand GZIP compression and learn how to decompress .gz files and strings in your browser. Free online GZIP decompressor with examples.

GZIP decompression guide: decompress .gz files and gzip-encoded strings online

GZIP decompression (often called gunzip) restores a single compressed stream back to its original bytes. You need it when you download access.log.gz, inspect a base64 gzip payload from an API, or decode HTTP responses sent with Content-Encoding: gzip. This guide explains how the GZIP format works (RFC 1952), how it differs from Zlib and raw DEFLATE, and how to decompress gzip online in your browser with our free Gzip Decompress tool. No install, no account, and processing stays on your device.

1F 8B

GZIP Magic Bytes

RFC 1952

GZIP File Format

1 File

Per .gz Stream

Local

Browser Decompression

Key facts: GZIP decompression (quick reference)

Use this block when you need a concise answer for search or AI summaries:

What is GZIP compression?

GZIP (GNU zip) is a lossless compression format built on the DEFLATE algorithm (LZ77 plus Huffman coding). Jean-loup Gailly and Mark Adler designed the on-disk .gz wrapper so Unix tools could compress single files for storage and transfer. Today GZIP is everywhere: web servers, CDN edge caches, log rotation (logrotate), database dumps, npm package tarballs, and backup pipelines.

Common reasons developers search for gzip decompress or gunzip online:

GZIP decompression flow from .gz file or base64 input through DEFLATE inflate and CRC verification to plain text output

Figure 1: Typical GZIP decompression path from input stream to readable output.

GZIP file structure (what gunzip actually does)

Understanding the wrapper helps you pick the right decoder and fix "incorrect header check" errors:

If your bytes start with 78 01, 78 9C, or 78 DA, you likely have Zlib, not GZIP. Use our Zlib decompression guide and the Zlib Decompress tool instead.

GZIP vs Zlib vs raw DEFLATE

Format RFC Typical start (hex) Checksum Common use
GZIP RFC 1952 1F 8B CRC-32 .gz files, HTTP Content-Encoding: gzip
Zlib RFC 1950 78 9C (and variants) ADLER-32 PNG IDAT, Git objects, some PDF streams
Raw DEFLATE RFC 1951 No standard magic None in stream ZIP entries, custom protocols

How to decompress GZIP: methods compared

Method Best for Install needed? Notes
Online Gzip Decompress (browser) Quick peek at text, base64 payloads, single .gz on any OS No Paste Base64 or upload .gz; output appears in the right panel.
gunzip / gzip -d Linux, macOS, WSL, servers Preinstalled on most Unix systems Replaces file.gz with decompressed file by default; use -k to keep the archive.
zcat / gzcat View log contents without writing a new file Same as gzip package Streams uncompressed bytes to stdout; pipe to grep or less.
tar -xzf .tar.gz / .tgz archives tar + gzip Two layers: gzip decompress, then tar extract. Not for lone .gz unless it is a tar inside.
Language libraries (zlib, pako) Automated scripts and apps Dev environment Use gzip-specific APIs (gzip.GzipFile, zlib.gunzipSync, pako.ungzip).

Method 1: Decompress GZIP online with the free Gzip Decompress tool (easiest)

The fastest way to decompress gzip online without a terminal is our Gzip Decompress page. It uses the Pako library in your browser to inflate gzip streams from pasted Base64 or uploaded files.

Steps to decompress gzip in your browser

  1. Open Gzip Decompress in Chrome, Firefox, Edge, or Safari.
  2. For text or Base64: Paste your gzip-encoded string into the left Input (Base64 or Raw) field. The tool decodes and decompresses as you type when the payload is valid.
  3. For binary files: Use Or Upload Gzip File and choose a .gz or .gzip file. The decompressed text appears in the right Decompressed Output panel.
  4. Read the output, copy it from the output field, or save it locally using your browser's usual copy workflow.
  5. If you see an error banner, confirm the file starts with gzip magic bytes and is not Zlib-only or a .tar.gz you meant to extract with tar.

Decompression runs client-side. That matters when you work with production logs, customer exports, or signed API responses you do not want to send to a third-party server.

Method 2: Decompress .gz files on the command line

gunzip (replace the .gz file)

# Decompress document.txt.gz → document.txt (removes .gz by default)
gunzip document.txt.gz

# Keep the original .gz after decompressing
gunzip -k document.txt.gz

# Same as gunzip
gzip -d document.txt.gz

zcat (view without extracting to disk)

# Print decompressed log to terminal
zcat /var/log/nginx/access.log.1.gz | head

# Search inside a .gz without creating a temp file
zgrep "ERROR" application.log.gz

tar.gz archives

# Extract all files from a tarball
tar -xzf release.tar.gz

# List contents without extracting
tar -tzf release.tar.gz

curl and HTTP gzip responses

Modern curl auto-decompresses when you pass --compressed. To inspect raw gzip bytes, omit decompression and save the body:

# Let curl inflate Content-Encoding: gzip
curl --compressed -s https://example.com/api/data

# Save raw gzip body to a file for offline decoding
curl -s -H "Accept-Encoding: gzip" https://example.com/api/data -o response.gz
gunzip -k response.gz

Method 3: Decompress GZIP in code

Python

import gzip
import base64

# From a .gz file on disk
with gzip.open("access.log.gz", "rt", encoding="utf-8") as f:
    print(f.read()[:500])

# From Base64 (common in JSON logs)
b64 = "H4sIAAAAAAAAA/NIzcnJVwjPL8pJAQBWsRdKCwAAAA=="
raw = base64.b64decode(b64)
print(gzip.decompress(raw).decode("utf-8"))

Node.js

const zlib = require('zlib');
const fs = require('fs');

// File
const input = fs.readFileSync('data.json.gz');
const text = zlib.gunzipSync(input).toString('utf8');
console.log(text);

// Base64 string
const fromB64 = Buffer.from(b64Payload, 'base64');
console.log(zlib.gunzipSync(fromB64).toString('utf8'));

PHP

<?php
$compressed = file_get_contents('dump.sql.gz');
$plain = gzdecode($compressed);
echo substr($plain, 0, 500);
?>

Common mistake: Calling gzuncompress() on a true .gz file. That function expects Zlib (RFC 1950), not the GZIP wrapper. Use gzdecode() for GZIP.

Tips and common mistakes

Related free tools

Frequently Asked Questions

How do I decompress a .gz file online for free?

Upload the .gz file or paste Base64-encoded gzip data into our Gzip Decompress tool. It inflates the stream in your browser and shows the decompressed text in the output panel. No sign-up is required.

What is the difference between gzip decompress and gunzip?

They mean the same operation. gunzip is the traditional Unix command name; gzip -d is equivalent. Both remove the GZIP wrapper and restore the original uncompressed bytes.

Why does gzip decompression fail with "incorrect header check"?

The input is probably not GZIP. Zlib streams start with bytes like 78 9C, and raw DEFLATE has no GZIP magic 1F 8B. Pick the matching format (Gzip vs Zlib vs raw) and the matching tool or API.

Can I decompress .tar.gz with a plain gzip tool?

A .tar.gz file is a tar archive wrapped in gzip. A gzip-only decoder yields a .tar blob, not individual files. Use tar -xzf on the command line or a tar-aware extractor for the full archive.

Is my file uploaded when I use the online gzip decompressor?

No. Our Gzip Decompress tool processes data locally in JavaScript. Your file contents stay on your device unless you copy or share them yourself.

Whether you are unpacking a rotated log, debugging a gzip API body, or learning how RFC 1952 wraps DEFLATE, a reliable gzip decompress online workflow saves time. Open the free Gzip Decompress tool, confirm magic bytes 1F 8B, and inspect your data in seconds.

Browse all posts