Online GZIP Compressor
Compress and decompress files locally in your browser using the RFC 1952 GZIP / DEFLATE algorithm with zero network uploads.
Drag & Drop or Click to Select File
Drag & drop or click to select a file.
Technical Architecture: Reverse-Engineering Client-Side GZIP​
The GZIP file format (RFC 1952) encapsulates raw DEFLATE-compressed byte streams (RFC 1951) within a standardized container featuring header magic bytes, modification timestamps, and a 32-bit Cyclic Redundancy Check (CRC-32) integrity checksum.
1. In-Memory ArrayBuffer Streaming & Compression​
The compressor bypasses server roundtrips by reading local files into memory via the Web FileReader API and passing raw byte buffers into a high-performance in-memory compression engine:
async function compressFile(file: File): Promise<Blob> {
const arrayBuffer = await file.arrayBuffer();
const inputBytes = new Uint8Array(arrayBuffer);
// Compress using DEFLATE algorithm at maximum compression level (level 9)
const compressedBytes = pako.gzip(inputBytes, { level: 9 });
return new Blob([compressedBytes], { type: 'application/gzip' });
}
Modern browser runtimes can also utilize the standard CompressionStream interface:
async function compressWithStream(file: File): Promise<Blob> {
const stream = file.stream().pipeThrough(new CompressionStream('gzip'));
const response = new Response(stream);
return await response.blob();
}
2. RFC 1952 Container Anatomy​
Every GZIP archive generated or decoded follows the binary structure defined in RFC 1952:
+---+---+---+---+---+---+---+---+---+---+
|ID1|ID2|CM |FLG| MTIME |XFL|OS | (10-byte header)
+---+---+---+---+---+---+---+---+---+---+
|... compressed DEFLATE payload ... |
+---+---+---+---+---+---+---+---+---+---+
| CRC32 | ISIZE | (8-byte trailer)
+---+---+---+---+---+---+---+---+---+---+
- ID1 / ID2 (Magic Bytes):
0x1Fand0x8Buniquely identify the byte stream as GZIP. - CM (Compression Method): Set to
0x08denoting the DEFLATE algorithm. - CRC32: A 32-bit checksum computed over the uncompressed input data to verify byte integrity upon extraction.
- ISIZE: Input size modulo 2³², representing the original uncompressed file size in bytes.
3. DOM Mounting, Synthetic Triggers & Memory Reclamation​
To deliver compressed files without hitting external endpoints, the application converts generated Blob references into ephemeral object URLs, mounts a synthetic anchor tag to trigger the browser's native download manager, and frees memory:
function triggerDownload(blob: Blob, filename: string): void {
const objectUrl = URL.createObjectURL(blob);
const anchor = document.createElement('a');
anchor.href = objectUrl;
anchor.download = filename;
document.body.appendChild(anchor);
anchor.click();
document.body.removeChild(anchor);
// Release memory from browser heap
setTimeout(() => URL.revokeObjectURL(objectUrl), 1000);
}
GZIP Header Field Specifications​
| Byte Offset | Field | Length | Description | Expected Value |
|---|---|---|---|---|
0x00 | ID1 | 1 byte | GZIP Identification Byte 1 | 0x1F (31 decimal) |
0x01 | ID2 | 1 byte | GZIP Identification Byte 2 | 0x8B (139 decimal) |
0x02 | CM | 1 byte | Compression Method | 0x08 (DEFLATE) |
0x03 | FLG | 1 byte | Header Flags (FTEXT, FHCRC, FEXTRA, FNAME, FCOMMENT) | 0x00 (Standard) |
0x04-0x07 | MTIME | 4 bytes | Unix modification timestamp | 32-bit integer |
0x08 | XFL | 1 byte | Extra flags | 0x02 (Max compression) |
0x09 | OS | 1 byte | Operating System identifier | 0x03 (Unix) / 0xFF (Unknown) |
| Trailer | CRC32 | 4 bytes | Cyclic redundancy checksum | Computed on input payload |
| Trailer | ISIZE | 4 bytes | Uncompressed input size modulo 2³² | Original byte count |
Client-Side Security & Zero-Server Data Isolation​
- Pure Local Execution: 100% of compression and decompression operations execute on your device's CPU. Files are never uploaded, buffered, or transmitted over any network connection.
- No File Size Egress Limits: Because processing is local, throughput is bounded only by your browser's heap memory allocation (typically capable of handling 200MB+ files smoothly).
- Heap Cleanliness: All created
Blobobject URLs are automatically reclaimed viaURL.revokeObjectURL()to prevent memory leaks during batch or repeated processing.
Get notified about updates to this tool
No spam. Just high-quality updates about new features and guides.
Related Tools​
Related Posts​
Markdown is a lightweight markup language that allows you to format plain text. It is widely used for documentation, writing articles, and creating web content.
A guide for senior developers on identifying and avoiding off-by-one errors in JavaScript with practical code examples.
You can check the history of a specific line in VS Code using the built-in features or the specific view. You can also install the free extension.

