Compression Demos

Run-Length

Simple lossless compression that replaces runs of repeated characters with the character followed by the count. Example: "aaabbc" becomes "a3b2c1".

0 chars
OUTPUT
0
Original Size
0
Encoded Size
Compression Ratio
0
Runs Found

How to use this tool

  1. Choose a mode with the Encode / Decode tabs at the top.
  2. Type or paste text into the Input box — the result updates live in the OUTPUT area.
  3. In Encode mode, each run becomes a character plus its count, so aaabbc becomes a3b2c1.
  4. In Decode mode, paste an RLE string like a3b2c1 to expand it back to the original text.
  5. Read the stats below the output — Original Size, Encoded Size, Compression Ratio, and Runs Found — and watch the color-coded run chips.
  6. Use Copy Output to copy the result, or Clear to reset the input.

Why this tool is helpful

Visualize how runs work

Color-coded chips break the input into runs of character + count, so the encoding is visible at a glance.

Learn a classic algorithm

RLE is the basis of formats like PCX, BMP, TIFF, and fax compression. See the exact mechanics without reading a spec.

Check if data will shrink

The Compression Ratio stat reports "smaller" or "larger", since RLE only helps data with many repeated characters.

Debug RLE strings

Paste an encoded string into Decode mode to expand it and confirm each count is correct.

See whitespace clearly

Spaces, tabs, and newlines are encoded like any other character and rendered as , \t, and \n in the run chips.

Stay private

Everything runs locally in your browser. Nothing is uploaded, logged, or sent to a server.

FAQ

What is run-length encoding (RLE)?

RLE is a lossless compression scheme that replaces runs of identical characters with the character followed by the count. For example, aaabbc becomes a3b2c1.

Is RLE lossless?

Yes. Every run records its exact character and count, so the original text is reconstructed perfectly on decode — no data is lost.

Why is my output longer than my input?

This tool writes a count after every character, even a run of one, so abc becomes a1b1c1. On data with few repeats, RLE can expand it — the Compression Ratio stat will show "larger".

How are multi-digit counts handled?

A run of ten or more uses a multi-digit count, so ten a characters encode as a10. Decoding reads all consecutive digits after a character as its count.

Does it handle spaces, tabs, and newlines?

Yes. Whitespace is treated like any other character and is encoded as a normal run. In the visual display, spaces appear as , tabs as \t, and newlines as \n.

What format does Decode mode expect?

A sequence of runs, each a character immediately followed by its count as digits — for example a3b2c1. A character with no following digits is ignored.

Does any of my data leave my browser?

Never. All encoding and decoding happens locally in JavaScript, and your input is not sent to, stored on, or logged by any server.