GZIP compressor/decompressor

Encoding/decoding

Compresses and decompresses Zlib- or GZIP-encoded data stream (RFC 1950/1952).

This online tool encodes or decodes data using Zlib (RFC 1950) or GZIP format 4.3 (RFC 1952). 

Max size of the input data is 10 MiB.

clear
clear
clear

Wrappers are executed in sequence on shared data string. For example, to supply base64-encoded stream of GZIP-compressed data enter wrappers: base64, gzip and fill the data input with the base64 stream. 

If data is not entered information from other tabs (upload, by URL and direct) is used to replace data on this page. This lets you enter gzip as a wrapper here and upload a file using upload tab while leaving data on this page empty. 

Currently supported wrappers are: base64, bzip, cslashes, datauri, direct, ftp, ftps, gzip, hex2bin, http, https, qprintable, upload, url, urlencoding, zlib

  • Upload
  • By URL
  • Direct input
  • Custom
Ctrl+Shift+E ↔

GZIP compression is a widely used method of compressing web pages and other text data – sometimes it can reduce the size of source document by 70-80% at the same time requiring little CPU processing. 

On this page you can encode or decode GZ data online. You can do so by direct imput, by file upload or by URL. Also, different variants of GZ compression are supported: 

Getting gzdecode() work in PHP 4 and above 

As explained in this article, PHP has gzencode function to encode GZIP data but no gzdecode counterpart. However, it can be rewritten using readgzfile that will work in PHP 4+. 

PHP
// taken from http://proger.i-forge.net/gzdecode_doesnt_work_in_PHP_pre-6/OQB
function gzdecode($data) {
  do {
    
$tempName uniqid('temp ');
  } while (
file_exists($tempName));

  if (
file_put_contents($tempName$data)) {
    try {
      
ob_start();
        @
readgzfile($tempName);
      
$uncompressed ob_get_clean();
    } catch (
Exception $e) {
      
$ex $e;
    }

      
unlink($tempName);

    if (isset(
$ex)) {
      throw 
$ex;
    }

    return 
$uncompressed;
  }
}