Read this lesson as text
Caesar Cipher
Cryptography · Axiom Academy
The oldest and simplest substitution cipher Julius Caesar used this cipher to communicate with his generals. Historical records from Suetonius describe how Caesar would shift each letter by three positions in the alphabet. For example, with a shift of 3: This simple transformation was effective in Caesar's time because most of his enemies were illiterate and couldn't read Latin, let alone decode encrypted messages. The Caesar Cipher works by shifting each letter in the plaintext by a fixed number of positions in the alphabet. This fixed number is called the key or shift value . The mathematical representation for encryption is: x = plaintext letter value (A=0, B=1, C=2, ..., Z=25) mod 26 = ensures we wrap around the alphabet Example: Let's encrypt "HELLO" with a shift of 3: Decryption is the reverse process - we shift letters backward by the same key value to recover the original message. The mathematical representation for decryption is: Notice that decryption subtracts the key, while encryption adds it. The mod 26 ensures we handle negative numbers correctly by wrapping around the alphabet. Example: Let's decrypt "KHOOR" with a shift of 3 to recover "HELLO": The Caesar Cipher has a critical weakness: there are only 25 possible keys (shifts of 1 through 25; shift 0 and shift 26 don't encrypt anything). Let's see what happens when we try all possible shifts on an encrypted message:
This is the written version of the interactive lesson above. See the full Cryptography course.