To gzip compress text for a pasteable payload, convert the UTF-8 text to an RFC 1952 gzip stream and wrap those binary bytes in canonical padded Base64.

The Gzip Compress & Decompress tool performs that exact text workflow in the browser. It converts entered text to UTF-8 bytes, compresses them as a gzip stream, and displays the binary result as Base64 that can be copied into a text field. Its reverse mode decodes that Base64, validates the gzip container, and restores strictly valid UTF-8 text. Processing stays local, and the output includes a copy action.

gzip compress text
Gzip Compress Text: A Strict UTF-8 Workflow

Inside the gzip byte stream

Gzip is a lossless container, not a text encoding. The browser first converts the entered string into UTF-8 bytes, then passes those bytes through the browser’s gzip compression implementation. This distinction matters because visible character count and byte count are different: an accented character, emoji, or other non-ASCII character can require several UTF-8 bytes.

The resulting stream follows the format defined by RFC 1952. It begins with the gzip magic bytes 1f 8b, followed by a compression-method value of 8 for DEFLATE. Header fields and compressed blocks follow. At the end is an eight-byte little-endian trailer containing a CRC32 of the uncompressed bytes and an ISIZE value representing the input size modulo 2^32. The implementation creates and validates this framing.

Base64 is only the transport wrapper around that binary stream. It changes the characters used to display the data, not the gzip bytes represented by it. The tool produces padded Base64 without spaces, line wraps, a data-URL prefix, or a filename, so the complete result can be copied as one text value.

Match the container your destination expects

“Gzip,” “gzip Base64,” and “.gz file” can describe related but different delivery formats. Confirm the receiver’s requirements before pasting the result.

Format What it contains How it is normally transferred
Raw gzip bytes An RFC 1952 binary gzip stream Sent or saved as binary bytes
Base64-wrapped gzip The same gzip stream represented as canonical padded Base64 Pasted as text, then decoded by a compatible receiver
HTTP Content-Encoding: gzip An HTTP body encoded as gzip with an accompanying response header Configured in an HTTP response, not pasted into the header value
.gz file A gzip stream stored in a file container Transferred or downloaded as a file

The tool described here produces the second format: Base64-wrapped gzip. It does not create an HTTP response header or provide a binary .gz file download. If a destination explicitly requires raw gzip bytes, the Base64 layer must first be decoded in a binary-capable workflow. If it expects Base64 gzip, the complete value produced by this tool is the relevant representation.

Compress UTF-8 text into gzip Base64

Use this sequence when the source is text and the result must survive a trip through a text field or text-based API field.

  1. Open the correct mode. Go to Gzip Compress & Decompress and choose UTF-8 text to gzip Base64. The reverse option is intended for turning existing gzip Base64 back into text.
  2. Enter the source text. Paste or type the complete text value. The workflow treats the entered string as Unicode text and converts it to UTF-8 bytes before compression. Check any legacy character encoding before pasting; this page is not a legacy-encoding detector.
  3. Run the compression. Select the compress action. The browser’s Compression Streams implementation converts the UTF-8 bytes into a standards-compatible gzip stream rather than merely shortening or obfuscating the visible text.
  4. Copy the complete result. Use the copy action to capture the full padded Base64 string. Do not remove characters, add spaces, insert line breaks, or attach a data-URL prefix. Any change to the Base64 text can make strict decoding fail.
  5. Send it in the expected representation. Paste the result only where the receiver expects Base64-wrapped gzip. Do not treat it as raw gzip, an HTTP header value, or an encrypted value. If the destination specifies raw gzip bytes, decode the Base64 into binary first with an appropriate binary workflow.

The resulting length depends on the content and on the encoder’s choices. Highly repetitive text may compress well, while very short or difficult-to-compress text may not gain much. The Base64 wrapper can also make a small payload larger than the original text, so the actual output is the useful measure.

Restore text from gzip Base64

Reversing the process validates each layer rather than attempting to repair malformed input.

  1. Choose the reverse mode. Select Gzip Base64 to UTF-8 in the same gzip tool.
  2. Paste only the canonical Base64 payload. The input must be a continuous, padded RFC 4648 Base64 string representing an RFC 1952 gzip stream. Missing padding, embedded whitespace, invalid alphabet characters, and nonzero pad bits are rejected. Do not include a data-URL prefix, filename, explanation, or surrounding quotes unless they are part of the actual Base64 value.
  3. Run decompression. The tool first performs strict Base64 decoding, then checks the minimum gzip framing and magic bytes before passing the bytes to the browser decompressor. The compressed stream and its trailer are verified; corrupt or incomplete input returns an error instead of partial text.
  4. Copy and validate the restored text. Copy the decompressed value and compare its meaning with the original source. Also confirm that the receiving application expects the same container you used. A successful round trip confirms the text workflow, but it cannot make a raw-gzip requirement accept a Base64-wrapped value automatically.

A valid gzip stream does not necessarily contain text. If the decompressed bytes represent an image, archive, executable, or legacy-encoded document, the strict UTF-8 decoder reports that the result is not UTF-8. It does not replace invalid bytes or corrupt the output. Use a binary file gzip tool for those payloads.

Checks and limits that affect the result

The workflow validates the representation, the gzip container, the compressed data, and the decoded text independently. These checks explain why a value that looks like Base64 may still be rejected.

Layer Validation Outcome
Base64 syntax Strict RFC 4648 decoding checks padding, whitespace, alphabet characters, and pad bits Malformed Base64 is rejected before gzip processing
Gzip framing The minimum structure, magic bytes 1f 8b, and method value 8 are checked Data that is not a gzip stream is rejected
Compressed data and trailer The browser verifies the stream and the trailer’s CRC32 and ISIZE information Corrupt or incomplete data returns an error rather than partial text
Decoded content Decompressed bytes must form strictly valid UTF-8 Binary or incorrectly encoded text is rejected without replacement characters
Size Input and decompressed output are each limited to 5,000,000 bytes Oversized work is stopped, and output is never silently truncated

CRC32 helps detect accidental corruption, but it is not a cryptographic integrity guarantee against an attacker who can modify the data. Likewise, gzip compression is not encryption, secrecy, authentication, or sanitization. Compressed text is generally less readable, but anyone with the data can decompress it. Do not use gzip output to protect credentials or other sensitive information.

Two gzip tools may produce different Base64 strings for the same input. Header fields, DEFLATE choices, and compression levels can differ even when both outputs restore identical content. Validate the decompressed result and the gzip framing rather than expecting one exact compressed spelling.

When this workflow fits

This page is appropriate when the source is UTF-8 text, the destination explicitly expects gzip data, and the transfer channel accepts a Base64 text representation. It is especially useful when a binary gzip value needs to be pasted into a form, stored in a text field, or carried through an API that rejects raw binary.

It is not the right workflow for a `.gz` image, archive, executable, or other binary object. Nor does it convert raw gzip bytes into Base64; the supported direction begins with UTF-8 text. Use a binary gzip utility when the payload is not text, when a file download is required, or when the destination expects a different transfer mechanism.

For a compatible text destination, the complete process is straightforward: UTF-8 text becomes gzip bytes, the bytes become canonical padded Base64, and the receiver decodes Base64 before decompressing the gzip stream and validating the restored UTF-8 content. Confirm that exact container at both ends rather than assuming that every gzip-related label means the same thing.

Related reading: Hex to Text Online: Hexadecimal Format Guide.

Related reading: Morse Code Translator on Android: Browser Workflow.