Compression workflow

Gzip, zlib and raw DEFLATE: containers, bytes and safe local previews

DEFLATE is a compression algorithm; gzip and zlib wrap it in different containers. Select the format from the source protocol rather than guessing from the file extension or a successful decode.

Content updated: · Maintainer and corrections

Three containers, one explicit choice

Gzip uses an RFC 1952 header and CRC32 / size trailer. Zlib uses an RFC 1950 wrapper and Adler-32; raw DEFLATE is the RFC 1951 stream without a container checksum. The native format names are gzip, deflate (zlib-wrapped) and deflate-raw. Raw output being smaller does not make it the best interchangeable format.

The gzip format permits concatenated members, but the Compression Streams standard accepts only one member. The native zlib decoder does not support preset dictionaries. Wrong containers, truncated streams, failed checksums and trailing bytes may be rejected. An error message cannot reliably identify the precise checksum or damaged offset. This tool never retries other containers automatically.

Base64 is transport encoding, not compression

Standard Base64 represents binary bytes as text and normally expands the size. Decode Base64 to compressed bytes first, then decompress the known container. This tool requires canonical padding and pad bits; it does not repair Base64URL, data URLs or malformed input. Hex also expands bytes and requires complete byte pairs.

Size summaries compare binary compressed bytes with original bytes, excluding Base64 / Hex text overhead. Small input can grow because of container and compression overhead. An empty original has no meaningful percentage saving. Compression output can differ between browsers or versions; compare decompressed bytes, not an assumed universal compressed byte sequence.

Keep files as bytes and previews as text

Local files preserve BOMs, line endings, NULs and arbitrary binary data. Pasted text is encoded as UTF-8 without normalization, but a textarea or clipboard can normalize line endings; use files for an exact byte round trip. Unpaired Unicode surrogates are rejected. Invalid UTF-8 output remains a successful binary decode: switch to Hex / Base64 or download all bytes instead of replacing undecodable characters.

ZIP is a different archive format. A .tar.gz file decompresses to TAR bytes; this tool does not extract its files. Output uses a fixed safe filename rather than trusting embedded gzip names. Downloaded HTML, SVG or scripts are never rendered or executed by the tool; downloaded content still needs your own trust decision.

HTTP decoding is a separate layer

Content-Encoding describes HTTP representation coding; Content-Disposition describes a suggested download presentation / filename. Browser Fetch normally decodes HTTP Content-Encoding before exposing response bytes. Do not manually decompress bytes that were already decoded merely because a response header says gzip.

This offline workbench does not fetch a URL, inspect a live server or prove compression is enabled in production. Inspect the actual response and receiving runtime separately. Neither decompression success nor CRC32 / Adler-32 provides authentication, encryption or a content-safety certificate.

Local-first does not mean unlimited resources

Tool data stays in page / Worker memory, not uploads, storage, URLs or tool analytics. Pasted source is limited to 1 MiB; local files to 5 MiB; output to 16 MiB with a 5-second Worker timeout and Cancel. Output size is checked chunk by chunk before final assembly. Errors and cancellation discard all results, and editing input invalidates prior exports.

The preview is capped at 32,000 characters. Complete Base64 / Hex copy is available only up to 1 MiB encoded characters; otherwise download the binary result. Resource limits reduce decompression-bomb risk but cannot guarantee the native decoder's peak memory. Format support varies by browser / version and must exist in Workers; there is no upload fallback. Brotli, Zstd, dictionaries and multi-member gzip are outside this tool's supported scope.

UTF-8 text → gzip bytes → standard Base64
Standard Base64 → gzip bytes → original bytes

.tar.gz → decompress gzip → TAR bytes (not extracted files)
Small inputs may become larger. Raw DEFLATE has no container checksum.

Data provenance

Sources