Loading GZIP to Base64 Converter...
How to Use the GZIP to Base64 Converter
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:
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" }
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:
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:
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.
Useful Resources
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.
Related Tools
PDF to Base64
Convert PDF files to Base64 encoded strings for APIs and databases
Base64 to PDF
Turn a Base64 string back into a PDF file you can download
File to Base64
Convert any file type to Base64 encoded strings for universal data transmission
Base64 to File
Decode Base64 strings to any file type with automatic format detection
Base64 to GZIP
Decode Base64 and decompress the GZIP data inside it
Base64 to ZLIB
Decode Base64 and decompress the ZLIB data inside it