Run-length encoding

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

This page exists due to the efforts of the following people:

Timur

Timur

Created: 2022-09-21 08:44:29, Last updated: 2022-09-21 08:44:29
Creative Commons Attribution/Share-Alike License 3.0 (Unported)

This content is licensed under Creative Commons Attribution/Share-Alike License 3.0 (Unported). That means you may freely redistribute or modify this content under the same license conditions and must attribute the original author by placing a hyperlink from your site to this work https://planetcalc.com/8670/. Also, please do not modify any references to the original work (if any) contained in this content.

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