Toolstia / Run length encoding tool
Run length encoding tool
Run length encoding (RLE) replaces each run of the same character with the number of repeats and the character. Encode text to see how much shorter it gets, or decode an RLE string back to the original.
Run length encoding replaces a run of the same character with a count and the character, so aaabcc becomes 3a1b2c. It shrinks data with long runs, such as simple images, and makes text without runs longer.
How it works
- Choose encode or decode, and the style.
- Enter your text.
- Copy the result and see how many characters were saved.
How it works
The text is read left to right. Every run of one repeated character becomes a count and the character, so aaabcc becomes 3a1b2c.
Two styles
Count first writes 3a. Character first writes a3. Pick the one your course or code expects.
When it helps
RLE shrinks data with long runs, such as simple pictures and fax data. Text without runs gets longer, since every character gets a count.
Digits in the text
If the original text contains digits, the encoded form cannot be read back reliably, so the tool warns you.
Questions
Is my text uploaded?
Everything happens in your browser, and nothing you enter is sent anywhere.
Does it handle emoji and new lines?
Yes. Characters are read as full characters, and a new line counts like any other character.
Why does my result get longer?
When there are few repeats, each single character still gets a count of 1, which doubles its size.