Caesar cipher wrap-around with MOD 26
Caesar wrap-around rule: with A=0 to Z=25, add the shift then take MOD 26 so letters past Z loop back to A. Example: X (23) + 5 = 28, MOD 26 = 2, which is C.
Understanding Caesar cipher wrap-around with MOD 26 in ACARA Digital Technologies Years 9–10
What it does: Adding the shift can go past 25 (Z). MOD 26 wraps the number back into the range 0 to 25, so Z loops round to A. 23 + 5 = 28, which is past Z (25). 28 MOD 26 = 2, and position 2 is C. The alphabet has 26 letters, so we use MOD 26. The remainder is always between 0 and 25, which matches the positions A to Z. 24 + 3 = 27. 27 MOD 26 = 1, and position 1 is B. 20 + 6 = 26. 26 MOD 26 = 0, which is A. The alphabet has looped all the way round.
Common mistakes: Capital letters start at ord 65, not 97 (that is for lowercase). Subtracting 97 gives a negative position. It should be ord('X') - 65 so that X = 23. The alphabet has 26 letters, so the wrap-around uses MOD 26. MOD 25 gives the wrong result: Z (25) + 3 = 28, and 28 MOD 26 = 2 (C). It should be % 26.
Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.
This module's key terms are also in a printable crossword (Modules 828–859) and word search (Modules 810–859).
Take this worksheet further — free with Cloodit
Each concept is reinforced from every angle — learned, then applied, then tested.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
(position + shift) MOD 26Fill in the Blanks
Spot the Error
Student with a class code? Join your class →