Caesar Cipher

A secret note written by shifting every letter by a fixed number of steps, readable only by someone who knows the secret shift rule.

Definition The Caesar cipher is one of the oldest and simplest encryption techniques, where each letter in a message is replaced by another letter found a fixed number of positions down the alphabet. It scrambles text so outsiders cannot read it, yet anyone who knows the shift count can easily decode it.

Shifting the Alphabet to Write Secret Notes

Imagine writing a secret note to a friend by shifting every letter one step forward in the alphabet. You write 'B' instead of 'A', and 'C' instead of 'B'. With this simple rule, the word 'CAT' turns into 'DBU', hiding its meaning from curious eyes.

Ancient Roman general Julius Caesar used this exact method to send confidential military orders across the battlefield. In his messages, every letter was shifted three spots to the right.

For instance, 'A' became 'D', 'B' became 'E', and letters at the end wrapped back around so 'Z' became 'C'. Replacing each letter one-for-one with another specific letter is called a monoalphabetic substitution cipher. It was a clever trick to ensure that even if an enemy intercepted the messenger, the battle plans remained confidential.

Caesar Cipher Disk & Shift of 3 A B C D E F G H I J K L D E F G H I J K L A B C Outer (Plaintext) A Shift +3 Inner (Ciphertext) D A β†’ D (1:1 Map) B β†’ E, C β†’ F Rule

The Ancestor of Modern Symmetric Key Encryption

In cryptography, the original readable message is called plaintext, while the scrambled text is called ciphertext. The process of turning plaintext into ciphertext is encryption, and unscrambling it back into readable text is decryption.

The core secret of the Caesar cipher is simply 'how many spaces the letters were shifted.' In cryptography, this shift amount is known as the secret key. If the key is '3', you shift letters by three spaces; if the key is '5', you shift by five.

Both the sender and the recipient must agree on the exact same secret key beforehand. If a message was encrypted by shifting three spaces forward, the recipient decrypts it by shifting three spaces backward. Because both sides rely on the exact same key to lock and unlock the message, the Caesar cipher is considered the earliest ancestor of modern symmetric key encryption.

Going Deeper: Why Is It No Longer Secure Today?

To be precise, the Caesar cipher offers zero security in modern computing. Because the English alphabet contains only 26 letters, there are only 25 possible shifts you can make.

An attacker does not even need a computer. By simply writing out all 25 possible shifts on a sheet of paper, anyone can crack the cipher in under five minutes. Systematically testing every single possible key until the right one appears is known as a brute-force attack.

Even with larger alphabets, simple substitution remains vulnerable. In natural languages, certain letters appear far more frequently than others (such as 'E' and 'T' in English). By counting letter occurrences through frequency analysis, an attacker can quickly identify the shift rule. That is why modern cryptography relies on complex mathematical algorithms and astronomically large keys instead of simple letter shifts.

πŸ€” Common misconceptions

βœ• Myth

The Caesar cipher was an unbreakable, foolproof encryption method before modern computers were invented.

βœ“ Fact

Because there are only 25 possible shifts in the English alphabet, anyone could easily break it by hand using simple trial-and-error or frequency analysis.

🧺 Where you meet it

1 Encrypting the word 'CAT' with a shift key of 3 to produce 'FDW'.
2 The 'ROT13' cipher, commonly used on online forums to hide movie spoilers by shifting letters 13 places.
πŸ’‘ In one sentence

The Caesar cipher is the foundational symmetric encryption method that conceals messages by shifting letters along the alphabet by a fixed number of spaces.