Gzip Compress Online — Text to Gzip Base64

Compress JSON, logs, HTML, or any UTF-8 text into gzip-encoded base64 instantly. Powered by the native browser CompressionStream API — no upload, no library, no rate limits.

Gzip vs Deflate vs Zlib — what is the difference?

All three names refer to the same DEFLATE algorithm with different wrappers. DEFLATE (RFC 1951) is the raw compressed payload. Zlib (RFC 1950) wraps DEFLATE with a 2-byte header and a 4-byte Adler-32 checksum. Gzip (RFC 1952) wraps DEFLATE with a 10-byte header (magic bytes, mtime, OS), optional file metadata, and a CRC-32 + ISIZE trailer — making it suitable for files and HTTP transport.

This tool uses the browser's built-in CompressionStream('gzip') — the same engine that powers fetch() response decoding. It produces fully RFC 1952-compliant output that gunzip, zcat, Python gzip.decompress, Node zlib.gunzipSync, and any HTTP client will accept.

How to compress text with gzip — 4 steps

  1. Paste your text. Drop a JSON payload, log file, or HTML snippet into the Input panel. Click Load Sample for a demo.
  2. Click Compress. The browser streams your text through the native gzip encoder and emits compressed bytes.
  3. Read the ratio. The badge shows original size, compressed size, and percent saved — typically 60–80% for text.
  4. Copy the base64. Use the Copy button to paste the result into HTTP bodies, environment variables, JSON values, or shell pipelines.

Sample input & output

Input — 372-byte JSON

{"users":[{"id":1,"name":"Alice","role":"admin"},{"id":2,"name":"Bob","role":"user"}]}

Output — gzip base64 (≈ 50% smaller)

H4sIAAAAAAAAA6tWSlSyUjA0MDDQUcosKlGyUkpKLFKK1VFKzs8tSE1RsgIyDIDM7Pz...

RFC 1952 Compliant

Output is standard gzip — accepted by gunzip, zcat, Python gzip, Node zlib, every HTTP server, and every CDN edge.

Native Browser Engine

Built on CompressionStream — no JavaScript zlib library bundled. Compresses megabytes in milliseconds using the browser's C++ engine.

Zero Network

Text is processed inside the page. Verify in DevTools Network tab — no requests fire when you click Compress.

Common use cases

  • check_circleGenerating gzip payloads for HTTP requests with Content-Encoding: gzip
  • check_circleReducing API response size before storing in caches, queues, or databases
  • check_circleCompressing log lines before shipping to S3, CloudWatch, or Loki
  • check_circleBundling configuration files for embedded firmware or container images
  • check_circleBuilding gzip fixtures for unit tests of decompression code paths
  • check_circleCompressing JWT or cookie payloads that exceed header size limits
  • check_circlePre-compressing static assets (HTML, CSS, JS) for serving with .gz suffix
  • check_circleEmbedding compressed JSON inside a QR code or URL fragment

Gzip vs Brotli vs Deflate — at a glance

FormatWrapperTypical RatioBest For
gzip10-byte header + CRC-3260–80% on textFiles, HTTP transport, ubiquitous tooling
deflate-rawnone (RFC 1951)60–80% on textInside ZIP entries, PNG IDAT chunks
deflate (zlib)2-byte header + Adler-3260–80% on textPNG, Git objects, Java JAR, MySQL
brotlicustom header75–90% on textHTTPS responses to modern browsers

Need to decompress instead?

Reverse the operation, switch to deflate/zlib, or chain compression with base64 and minify tools.

Frequently Asked Questions

What is gzip compression?

Gzip is a lossless compression format defined in RFC 1952 that wraps DEFLATE-compressed data with a small header (file metadata, mtime) and a CRC-32 trailer. It is the default Content-Encoding used by HTTP servers, the format produced by the gzip command-line tool, and the on-disk format for .gz files.

How does this gzip tool work without a server?

Modern browsers ship a built-in CompressionStream API (Chrome 80+, Firefox 113+, Safari 16.4+). The tool wraps your text in a Blob, pipes it through new CompressionStream("gzip"), reads the resulting bytes, and base64-encodes them. No JavaScript zlib library is bundled — the engine itself does the work.

Why is my output base64 instead of raw bytes?

Gzip output is binary — it cannot be safely copied or pasted as text. Base64 turns the bytes into a printable ASCII string so you can paste the payload into JSON, environment variables, HTTP headers, query strings, or YAML config without losing data.

How much will my text shrink?

Gzip typically reduces text by 60–80%. JSON and HTML compress especially well because of repeated keys and tags. Already-compressed data (PNG, JPEG, MP4, ZIP) usually grows slightly because the header adds overhead with no gain. Tiny payloads under ~30 bytes can also grow due to the gzip header.

Is gzip the same as zip?

No. ZIP is an archive format that bundles many files plus a central directory; each entry inside a ZIP is typically DEFLATE-compressed. Gzip compresses a single byte stream and adds no archive structure — to bundle multiple files you wrap them in tar first (tar.gz).

Should I use gzip or brotli for HTTP responses?

Brotli (br) compresses 15–25% better than gzip for text but is slower at the highest levels. Gzip is universally supported by every browser and CDN; brotli is supported by all modern browsers but only over HTTPS. Most CDNs negotiate brotli when available and fall back to gzip — serve both.

Is my text uploaded anywhere?

No. Compression runs entirely in your browser via CompressionStream. Open DevTools Network tab and click Compress — you will see no requests. Sensitive payloads, secrets, and proprietary JSON never leave your device.

Can I decompress the result back to text?

Yes — paste the base64 output into the companion Gzip Decompress tool, or run echo "<base64>" | base64 -d | gunzip on a Unix shell. Any RFC 1952-compliant gzip decoder will accept the bytes.

Gzip Compress Online — Free Text to Gzip Base64 Encoder