Free tools · Data

Which compressor wins your data?

RLE, Huffman, LZW, LZ78, LZ77, a gzip-style pipeline and real zlib, raw DEFLATE, gzip and Brotli raced over ten data types, four lengths, or your own text — computed on your device, never uploaded.

Eleven algorithms, one input

Race RLE, Huffman, LZW, LZ78, LZ77, a gzip-style duo and real zlib, raw DEFLATE, gzip and Brotli.

Pick a sample dataset and length, or paste your own text. Every byte compresses on your device — nothing is stored or uploaded, and custom input wipes after ten idle minutes.

Input length
COMPRESSED / LOCAL ONLY

English prose · 1 KB: LZ77 + Huffman wins.

Original: 1,024 B · preview: “Lossless compression removes redundancy without losing a single byte of meaning. Dictionary coders replace repeats with pointers while entropy coders spend fewe…

Run-Length Encoding
2,018 B · 1.97× · −97.1% (larger than input)
Huffman Coding
800 B · 0.78× · +21.9%
LZW Dictionary
1,054 B · 1.03× · −2.9% (larger than input)
LZ78 Phrases
1,155 B · 1.13× · −12.8% (larger than input)
LZ77 Sliding Window
772 B · 0.75× · +24.6%
LZ77 + Huffman — smallest
618 B · 0.60× · +39.6%

Racing real codecs (zlib, raw DEFLATE, gzip, Brotli)…

Sizes are honest totals: Huffman includes its 257-byte code table, LZW its 2-byte codes, LZ78 its index/byte pairs, LZ77 its flag bytes — and the pipeline pays both stages. Real codecs add their container overhead (zlib headers, gzip CRC-32). That overhead is why rankings flip with length.

Rows marked “larger than input” met incompressible data — every honest compressor expands randomness. That is the lesson, not a bug.

MEET THE CONTENDERS / LOCAL ONLY

What each algorithm exploits.

Run-Length Encoding (RLE)
How it works
Stores each run as a [count, value] pair. Near-optimal for long repeats, wasteful the moment runs disappear.
Best for
Long runs of identical bytes
Huffman Coding (Huffman)
How it works
Gives frequent bytes shorter bit codes, with a 257-byte code table stored alongside. Wins on skewed alphabets once the input outgrows the header.
Best for
Skewed symbol frequencies
LZW Dictionary (LZW)
How it works
Learns repeated phrases into a 4096-entry dictionary, emitting fixed 2-byte codes. Strong on long, pattern-rich data.
Best for
Repeated phrases and words
LZ78 Phrases (LZ78)
How it works
Learns phrases too, but emits explicit (phrase index, next byte) pairs instead of fixed codes. LZW's sibling, thriftier on short inputs.
Best for
Short inputs with a few repeats
LZ77 Sliding Window (LZ77)
How it works
Replaces repeats with (offset, length) pointers into the previous 4 KB. The ancestor of gzip's first stage.
Best for
Local repeats within 4 KB
LZ77 + Huffman (LZ77+Huff)
How it works
The gzip idea in two passes: LZ77 pointers first, Huffman over the tokens second. Usually beats either stage alone.
Best for
Almost anything compressible
Stored (Uncompressed) (Stored)
How it works
No compression: the raw input bytes. The honest baseline every other row must beat.
Best for
Incompressible data
zlib (DEFLATE) (zlib)
How it works
Real zlib-wrapped DEFLATE (RFC 1950): LZ77 plus Huffman with bit-packing, headers and an Adler-32 check. Decompresses with any zlib reader.
Best for
General text and data
Raw DEFLATE (RawDefl)
How it works
Bare DEFLATE bitstream (RFC 1951) with no wrapper. A few bytes smaller than zlib; the QR-payload form.
Best for
Tight envelopes
gzip (gzip)
How it works
DEFLATE in the gzip container (RFC 1952): headers plus a CRC-32 check. The web's download format.
Best for
Files and transfers
Brotli (Brotli)
How it works
Modern dictionary-plus-entropy codec; usually the smallest here on prose. Needs a Brotli decoder and may be unavailable in some browsers.
Best for
Prose and web assets

Six textbook byte-level implementations for teaching, plus Stored and real zlib, raw DEFLATE, gzip and Brotli via your browser — interoperable bytes you can decompress anywhere.

How it works

Three steps, all on your device.

The same redundancy trade-offs behind gzip and Brotli, made visible one input at a time.

01

Pick an input

Choose one of ten sample datasets — prose, runs, random text, JSON, DNA, logs, raw binary, digits, letters or pre-compressed bytes — at 256 B, 1 KB, 4 KB or 16 KB. Or switch to Custom text and paste anything.

02

Read the race

Six classic compressors plus Stored and real zlib, raw DEFLATE, gzip and Brotli run over the same bytes: compressed size, ratio and savings per algorithm, with the smallest crowned. Bars make the ranking instant.

03

Flip the variables

Change the data type or the length and watch the winner change — that crossover is the whole lesson. Copy the summary for notes or tickets.

Questions

Comparing compression, answered.

If you manage servers by hand, see the engineering services behind this tools series.

Is my custom text uploaded or stored anywhere?

No. All eleven compressors run entirely in your browser — the page makes no network requests, stores nothing, and wipes custom input after ten idle minutes (sooner if you press Clear). You can verify this in your browser's developer tools or disconnect from the network after the page loads.

Which compression techniques are compared?

Eleven lossless byte codecs: Run-Length Encoding (run pairs), Huffman coding (shorter codes for frequent bytes, with a 257-byte code table), LZW and LZ78 (two flavors of learned-dictionary coding), LZ77 (offset/length pointers into a 4 KB sliding window), an LZ77+Huffman two-pass staging of the gzip idea, plus Stored (uncompressed baseline) and real zlib, raw DEFLATE, gzip and Brotli via your browser's CompressionStream. Each is a real round-tripping implementation, not a simulation.

Why does the winner change with data type and length?

Every technique bets on a different kind of redundancy and pays a different header cost. RLE crushes long runs but doubles random data; Huffman's code table is worth it only once the input outgrows 257 bytes; LZW and LZ77 need enough length to learn phrases and find matches. Random data expands under all four — an honest compressor cannot shrink entropy.

Are the reported sizes honest totals?

Yes. Huffman includes its 257-byte code table, LZW its 2-byte-per-code stream, LZ77 its flag bytes and RLE its count bytes. Hiding headers would flatter small inputs; counting them is exactly why the rankings flip with length.

How is this different from gzip or Brotli?

The six textbook rows isolate each idea byte-aligned so you can see what it contributes. The Stored, zlib, raw DEFLATE, gzip and Brotli rows are the real interoperable codecs beside them — use the textbook rows to build intuition, then reach for the real rows to ship bytes.

What can I paste, and how large?

Any text up to 100,000 UTF-8 bytes — prose, JSON, CSV, code, log excerpts. That cap keeps encoding instant on the page. Sensitive text is safe to compare: it never leaves your device and clears after ten idle minutes.