See how Run-Length Encoding (RLE) and Huffman coding compress data โ with every step shown.
Designed with the WJEC specification in mindRLE replaces consecutive repeated characters with a count + character pair. Works best when data has long runs of the same value.
Huffman coding assigns shorter codes to more frequent characters. It's a variable-length, lossless compression technique.
RLE works best when data has many consecutive repeated values (e.g. simple graphics, fax documents). It can actually make data larger if there are few repeats.
Huffman coding works well when some characters appear much more often than others. The more skewed the frequency distribution, the better the compression.
Compression ratio = original size รท compressed size. Higher = better compression.