Skip to content
uencoder

Run-Length Encoding

Run-length encoding (RLE) replaces a sequence of repeated symbols with the symbol plus its repeat count, achieving high compression on long-run data.

Purpose

It compresses data containing many consecutive repeated characters or pixels, such as bitmaps, fax images, and simple graphics.

Mechanism

Scan the input, measure each run of identical symbols, and output (symbol, length) pairs; decoding expands the pairs back into the original sequence. Data without long runs may expand.

Use cases

  • Fax and bitmap compression
  • Simple image coding
  • Serializing sparse data

Related tools

References