Run-length encoding

This online calculator compresses the entered string using the run-length encoding (RLE) method.

Actually, the RLE (Run Length Encoding) compression method is probably the simplest data compression algorithm in which repeated characters (series, i.e. sequences consisting of several identical characters) are replaced by the single character and the number of its repetitions.

The algorithm:

  1. start from the first character
  2. add it to the result string
  3. count the number of repetitions of a character and add this number to the result string
  4. take the next character and repeat until the end of the original string

Example: the string “aaaabbbccd” after encoding the repetitions turns into the string “a4b3c2d1”, so instead of 10 characters we get 8. Compression is obvious!

The calculator below compresses the input string using the RLE method, and also displays the lengths of the original and resulting strings and the rate of data compression in percents.

PLANETCALC, Run-length encoding

Run-length encoding

Digits after the decimal point: 2
RLE String
 
Length of the original string
 
Length of the encoded string
 
Compression rate
 

URL copied to clipboard
PLANETCALC, Run-length encoding

Comments