Loading GZIP to Base64 Converter...

How to Use the GZIP to Base64 Converter

Step 1

Add Your Data

Anything can go in: text in any format, such as JSON, XML, CSV or logs, and binary files like images or PDFs. You can:

•
Paste directly: Copy and paste your data into the input editor
•
Upload a file: Pick any file. Text files show up in the editor; binary files are gzipped as they are without being shown
•
Try the sample: Press Sample to load a small JSON document

Example: Input Data Before GZIP Compression

This small JSON document (87 bytes) is the input for the example in Step 3:

{
  "message": "Hello, World!",
  "timestamp": "2024-01-15",
  "type": "notification"
}
Step 2

Let It Compress

About half a second after you stop typing, your data is compressed with the GZIP algorithm (the format behind HTTP compression, .gz files and the gzip command). What that means for you:

•
Size depends on the data: repetitive text such as large JSON or logs shrinks a lot, while a short snippet can come out a little bigger because of the 18-byte header and checksum. The badge above the output shows the real sizes
•
Standard GZIP: the decoded bytes are a normal .gz file that gunzip, Python and Node can open
•
Lossless: every byte comes back exactly, including long numbers like 8901240544102066246 and values like 00501
Step 3

Copy or Download the Base64

After GZIP compression, the tool encodes the compressed data to Base64 text, which fits in places that only accept plain characters:

•
Copy: puts the Base64 string on your clipboard, ready to paste into an API request or a database column
•
Download: saves the same string as a .gz.base64 text file
•
Check the sizes: the badge shows the original and gzipped size, in amber when the result got bigger

Example: Base64-Encoded GZIP Output

The JSON from Step 1 gzipped and encoded. Note it is longer than the input: this snippet is too short to gain from compression (87 bytes in, 93 bytes of GZIP, 124 characters of Base64).

H4sIAAAAAAAAA6vmUlBQyk0tLk5MT1WyUlDySM3JyddRCM8vyklRVNIByZZkAuVLEnMLQPJGBkYmugaGuoamUMnKArC+vPySzLTM5MSSzPw8Ja5aANmLfMhXAAAA

Every GZIP string starts with H4sI. Decode it with base64 -d and pipe it into gunzip to get the JSON back.

Frequently Asked Questions

What does this page actually produce?

A normal .gz file (RFC 1952), written out as Base64 text. Every string starts with H4sI, because that is how the GZIP magic bytes 1f 8b 08 look in Base64. Decode it and you have the same bytes gzip would have written to disk, so gunzip, zcat, Python's gzip module and Node's zlib.gunzipSync() all read it.

Will the Base64 be shorter than what I pasted?

Not always. GZIP adds about 18 bytes of header and checksum, and Base64 then makes everything a third longer. Big JSON exports, logs and CSV files with lots of repeated keys usually shrink well enough to come out ahead. A short snippet doesn't: the example below is 87 bytes of JSON, 93 bytes once gzipped and 124 characters of Base64. The badge above the output shows the real sizes for your own input, and turns amber when the result got bigger.

How do I get my original data back from the string?

Base64-decode it, then gunzip the bytes. On the command line that is base64 -d file.gz.base64 | gunzip. In Python it is gzip.decompress(base64.b64decode(s)), and in Node zlib.gunzipSync(Buffer.from(s, "base64")). Or paste the string into our Base64 to GZIP decoder. You get back exactly the bytes you put in.

Can I gzip a file rather than text?

Yes, any file type. Text files open in the editor so you can see them. Images, PDFs and other binary files aren't shown, but they are gzipped byte for byte, BOM and Windows line endings included, and the file name goes into the GZIP header the way gzip -N does. Download then saves the Base64 as a .gz.base64 file named after your upload.

How is this different from the GZIP compression page?

Both make the same GZIP data. Here, Copy and Download give you the Base64 text, which is what you need for a JSON field or a header value. The GZIP compression tool downloads the raw .gz file instead. If the code reading your data calls zlib.decompress() or inflate() rather than gunzip, you want ZLIB to Base64, which uses the smaller ZLIB wrapper.

Are numbers or special characters changed?

No. The page never parses your data, it only compresses the bytes. A long ID like 8901240544102066246, a zip code like 00501, a price written as 14.50 and text like José 😀 all come back exactly as typed when you decode the string.

Is my data sent anywhere?

No. Compression and Base64 encoding happen in your browser with the pako library. Nothing you paste or upload goes to our server, and nothing is kept: reload the page and the editor is empty again.