Search for a tool
RLE (Run-Length Encoding)

Tool for encoding / decoding with Run-Length Encoding (RLE), a very basic data compression algorithm that consists in describing a string according to its repetitions.

Results

RLE (Run-Length Encoding) -

Tag(s) : Compression

Share
Share
dCode and more

dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!


Please, check our dCode Discord community for help requests!
NB: for encrypted messages, test our automatic cipher identifier!


Thanks to your feedback and relevant comments, dCode has developed the best 'RLE (Run-Length Encoding)' tool, so feel free to write! Thank you!

RLE (Run-Length Encoding)

Sponsored ads

RLE Decoding



Parameters







See also: Conway Sequence

RLE Encoding



Parameters





Answers to Questions (FAQ)

What is Run Length Encoding? (Definition)

Run Length Encoding (or RLE, or range encoding) is a data compression (lossless) technique based on successive repetitions of elements.

Run Length means run length , and indeed, with RLE, what matters is the length, the size of the repetitions (in a text, a message, etc.)

RLE is a generic name for this compression technique, several ways to use and implement it exist.

How to encrypt using RLE compression?

The text to be encoded is scanned to find sequences of identical characters, then note the character and the number of repetitions in the sequence.

Example: DDDDDCCCCOOODDE can be described as 5 times the D character followed by 4 times the C character, etc. The message can therefore be compressed D5C4C3D2E1 (10 characters instead of 15, compression rate: 33%).

This procedure only produces compression if the message consists of many repetitions.

Example: DCODE would be compressed D1C1O1D1E1 (10 characters instead of 5, compression rate: -100%). In order to avoid this kind of case, it is possible to omit the 1 in the case of non-repetitions.

Writing variant

It is possible to encode by reversing the characters and the counts.

Example: 5D4C3C2D1E is then equivalent to D5C4C3D2E1

In case of Binary data

If the message is composed of binary data (0 and 1), then it is possible to use RLE without indicating the character, the numbers are sufficient. The first number indicating the 0 (or the 1), then alternatively.

Example: 00011110000 is coded 3,4,5

Case of Numerical data

If the message is made up of numbers, then use a separator otherwise it will no longer be possible to distinguish the characters from their number of repetitions.

Example: 11111111111122 is coded as '12 -1,2-2 'and not' 12122 'which could be translated as' 1' repeated 2122 times, or 1 times' 2 'followed by 12' times the number '2 ', etc.

How to decrypt using RLE decompression?

The RLE decompression consists in browsing the message formed of pairs (character, number of repetition) and writing the equivalent text by writing the character the corresponding number of times.

Example: D5C4C3D2E1 decomposes into D5, C4, O3, D2, C1 and repeats the characters the correct number of times: D5 => DDDDD > CCCC, etc. To get DDDDDCCCCOOODDE

Binary data case

Example: 3,4,5 is decoded 00011110000 (or 11100001111 depending on the convention used)

How to recognize a RLE ciphertext?

A message compressed with RLE is composed of pairs (Character-Number) or triples (Character-Separator-Number).

BMP and PCX image formats use RLE to reduce file size.

Source code

dCode retains ownership of the online 'RLE (Run-Length Encoding)' tool source code. Except explicit open source licence (indicated CC / Creative Commons / free), any 'RLE (Run-Length Encoding)' algorithm, applet or snippet (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, translator), or any 'RLE (Run-Length Encoding)' function (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) and no data download, script, copy-paste, or API access for 'RLE (Run-Length Encoding)' will be for free, same for offline use on PC, tablet, iPhone or Android ! dCode is free and online.

Need Help ?

Please, check our dCode Discord community for help requests!
NB: for encrypted messages, test our automatic cipher identifier!

Questions / Comments

Thanks to your feedback and relevant comments, dCode has developed the best 'RLE (Run-Length Encoding)' tool, so feel free to write! Thank you!


Source : https://www.dcode.fr/rle-compression
© 2021 dCode — The ultimate 'toolkit' to solve every games / riddles / geocaching / CTF.
Feedback