Graph
Run-Length Encoding

🗜️Run-Length Encoding

NEW

Also known as: RLE

A lossless compression technique representing consecutive repeated values as a single value with its count.

DESCRIPTION

Run-length encoding compresses data by replacing runs of identical symbols with value–count pairs. It is effective for images or data with long uniform sequences, such as monochrome bitmaps or simple graphics. RLE underpins formats like TIFF PackBits and the PDF RunLengthDecode filter. While simple and fast, it performs poorly on high-entropy data without long runs. RLE is often combined with other methods like entropy coding to improve compression. It is widely taught as a foundational algorithm in data compression. Implementations balance run markers, escape sequences, and edge-case handling. RLE supports streaming and can be reversible without loss. Its simplicity makes it popular in embedded systems and legacy formats.

ALTERNATIVE DEFINITIONS

NIST Dictionary of Algorithms and Data Structures

Run-length encoding is a method of data compression in which sequences of the same data value are stored as a single data value and count.

Concise dictionary definition highlighting value–count representation.

Source

Wolfram MathWorld

Run-length encoding is a form of lossless data compression in which runs of data are stored as a single data value and count.

Echoes lossless compression and run representation in mathematical reference.

Source

Encyclopaedia Britannica

Run-length encoding is a technique for compactly representing a sequence of identical symbols by storing the symbol and the number of times it repeats.

General audience description with symbol repetition emphasis.

Source

Lossless Compression Arithmetic Coding TIFF PackBits Bitmap Image Compression Ratio Source Coding Delta Encoding PNG

COMPETING TERMS

Huffman Coding Lempel–Ziv

RELATIONS

KNOWLEDGE AREAS

Software Engineering Data Engineering Data Storage & Operations

TARGET AUDIENCE

Software Developer Data Engineer Data Scientist

EXTERNAL SOURCES

TOP QUESTIONS

When is Run-Length Encoding most effective?

When data contains long runs of identical symbols such as simple graphics, monochrome images, or repetitive sequences.

Category: Requirements

What is a common misunderstanding about Run-Length Encoding?

That it always reduces size; it can increase size on noisy or high-entropy data without runs.

Category: Misunderstanding

What file formats use Run-Length Encoding?

TIFF PackBits and PDF RunLengthDecode leverage RLE to compress image and stream content.

Category: Example

What are the risks of applying Run-Length Encoding?

Applying RLE to unsuitable data wastes space and processing, yielding negative compression ratios.

Category: Risks

How does Run-Length Encoding relate to entropy coding?

RLE may precede entropy coding to exploit runs, then encode value–count pairs efficiently with Huffman or arithmetic coding.

Category: Explanation

Is Run-Length Encoding lossless?

Yes, RLE exactly reconstructs original data by expanding value–count pairs back into runs.

Category: Explanation

How do escape sequences work in RLE implementations?

They signal that a sequence is literal rather than a run, preventing ambiguity and managing short sequences.

Category: Application

Where to start learning Run-Length Encoding?

Read NIST DADS definition and study TIFF/PDF specifications describing RLE behavior and edge cases.

Category: WhereToStart

What is a striking analogy for Run-Length Encoding?

Writing “A×10” instead of “AAAAAAAAAA” to save space when characters repeat.

Category: Example