Encrypt a message
Caesar’s number
Julius Caesar shifted each letter of his alphabet by three positions. This is the oldest documented cipher, and the simplest to understand.
The principle
A shift is chosen — the key. With a key of 3:
clair A B C D E ... W X Y Z
chiffré D E F G H ... Z A B C
The end of the alphabet loops back to the beginning: after Z, we start again at A. The word MATHS therefore becomes PDWKV.
To decrypt, we shift in the opposite direction.
In mathematical notation
Let’s number the letters from 0 (A) to 25 (Z). Encrypting with the key k gives:
chiffré = (clair + k) mod 26
mod 26 means ‘the remainder when divided by 26’ — this is exactly what brings Z back to A. Decryption involves subtraction:
clair = (encrypted - k) mod 26
Why it’s broken
The key can only be between 0 and 25, giving 25 valid possibilities. An attacker can try them all in a matter of seconds and read the one that produces a French sentence: this is a brute-force attack.
clé 1 : OZSGR clé 2 : NYRFQ clé 3 : MATHS ← trouvé
Learn this lesson well; it applies to all modern cryptography: a key space that is too small dooms a system, no matter how elegant the method may be.

