AQA · GCSE · Computer Science

    Course version: 8525 · Version from Sept 2020

    Explain how data can be compressed using run length encoding (RLE).

    Full specification wording

    Data compression: Explain how data can be compressed using run length encoding (RLE).

    Run length encoding replaces repeated consecutive values with a count followed by the value, so long runs of identical data take less space.

    Checked against the AQA 8525 specification (opens in a new tab) on .

    • Point 10 of 13

    Study notes

    From the checked teaching notes for this specification point.

    The idea

    Run length encoding replaces repeated consecutive values with a count followed by the value, so long runs of identical data take less space. To encode, scan the data left to right, count how many times each value repeats in a row, and write the count then the value; a run of one is written as 1 followed by the value. For example, the pixel row AAAAA BB CCCCC becomes 5A 2B 5C. To decode, read each count and repeat the following value that many times. RLE works best where data has long runs, such as simple images with large areas of one colour, and poorly where values alternate, because short runs add count characters and can increase size. It is lossless, so the original data is recovered exactly.

    What earns the marks

    • State that RLE replaces a run of repeated consecutive values with a count and the value.
    • Describe encoding by counting consecutive identical values and writing count then value.
    • Describe decoding by repeating each value the number of times given by its count.
    • Explain that RLE is effective when data contains long runs and less effective when values alternate.
    • Recognise that RLE is lossless because the original data can be reconstructed exactly.

    Common mistakes and how to put them right

    • Counting non-consecutive repeats together.

      Put it right: RLE only groups values that are adjacent in the data.

    • Claiming RLE always reduces file size.

      Put it right: Alternating data can grow because extra count values are added.

    • Describing RLE as lossy.

      Put it right: RLE is lossless and restores the original exactly.

    Exam tips

    • Show a short worked example of encoding to demonstrate the count-then-value rule.
    • State when RLE is suitable and when it is not, using the idea of long versus short runs.
    • Mention that decoding reverses the process to recover the original data.

    Try the lesson

    The start of the Data compression: Explain how data can be compressed using run length encoding (RLE). lesson, made from checked teaching notes for this specification point.

    Have a go first

    How does run length encoding (RLE) reduce the size of data that contains repeated values?

    There is more to this lesson

    The full lesson goes on to check your understanding and help you earn the marks. Create a free account to carry on, with your progress saved.

    Carry on with the full lesson

    A week of Premium from your first lesson · Then the free plan continues · No card, no charge

    Test your understanding of Data compression: Explain how data can be compressed using run length encoding (RLE).

    Active recall beats re-reading. Take an instant quiz now to test what you’ve learned and lock it into long-term memory.

    Take topic quiz

    A week of Premium from your first lesson · Then the free plan continues · No card, no charge