Skip to main content

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): 0x1F and 0x8B uniquely identify the byte stream as GZIP.
  • CM (Compression Method): Set to 0x08 denoting 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 OffsetFieldLengthDescriptionExpected Value
0x00ID11 byteGZIP Identification Byte 10x1F (31 decimal)
0x01ID21 byteGZIP Identification Byte 20x8B (139 decimal)
0x02CM1 byteCompression Method0x08 (DEFLATE)
0x03FLG1 byteHeader Flags (FTEXT, FHCRC, FEXTRA, FNAME, FCOMMENT)0x00 (Standard)
0x04-0x07MTIME4 bytesUnix modification timestamp32-bit integer
0x08XFL1 byteExtra flags0x02 (Max compression)
0x09OS1 byteOperating System identifier0x03 (Unix) / 0xFF (Unknown)
TrailerCRC324 bytesCyclic redundancy checksumComputed on input payload
TrailerISIZE4 bytesUncompressed 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 Blob object URLs are automatically reclaimed via URL.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.