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.
- start from the first character
- add it to the result string
- count the number of repetitions of a character and add this number to the result string
- 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.