Caesar Cipher Explained With Examples
According to the Roman historian Suetonius, Julius Caesar protected military messages by shifting each letter three places down the alphabet. More than 2,000 years later, the Caesar cipher is still the first cipher most people learn.
Here's how it works, with examples — and how to break it.
What Is a Caesar Cipher?
A Caesar cipher is a substitution cipher that replaces each letter with the letter a fixed number of positions further along the alphabet. With a shift of 3, A becomes D, B becomes E, and so on. At the end, the alphabet wraps around: X becomes A, Y becomes B, Z becomes C.
The Counterintuitive Truth: The Caesar Cipher Was Probably Secure in Its Time
Today, a child can break a Caesar cipher. But in ancient Rome, many enemies couldn't read at all — and systematic codebreaking methods hadn't been developed.
Security depends on the attacker. We call this context security: a cipher that is weak by modern standards but effective against the people it was meant to fool.
How It Works
Shift of 3
Plain: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Cipher: D E F G H I J K L M N O P Q R S T U V W X Y Z A B C
Example 1
HELLO → KHOOR
| Plain | H | E | L | L | O |
|---|---|---|---|---|---|
| Cipher | K | H | O | O | R |
Example 2
VENI VIDI VICI → YHQL YLGL YLFL
Example 3 (Shift 13 = ROT13)
FUN → SHA
Apply ROT13 again and you get FUN back.
The Maths
Number letters A=0 to Z=25:
- Encrypt: C = (P + k) mod 26
- Decrypt: P = (C − k) mod 26
Where k is the shift.
We call this wraparound arithmetic: modular maths that makes the alphabet behave like a clock.
How to Crack a Caesar Cipher
Method 1: Brute Force
Try all 25 shifts. One will produce readable text.
Method 2: Frequency Analysis
In English, E is the most common letter. Find the most common letter in the ciphertext and assume it's E.
Method 3: Look for Short Words
Single-letter words are usually A or I. Three-letter words are often THE or AND.
Variations
| Cipher | Difference |
|---|---|
| ROT13 | Always shift 13 |
| Atbash | Reverse the alphabet |
| Vigenère | Different shifts using a keyword |
| Affine | Multiplies and shifts |
See more in 10 Famous Ciphers and How They Work.
Build One in Cipher Studio
- Open Cipher Studio.
- Add a Caesar cipher module.
- Set your shift.
- Type a message and watch it encrypt instantly.
- Add more steps — like Base64 or Morse — for a multi-layer puzzle.
Save your pipeline for later: Cipher Studio: Save and Load Your Encoding Pipelines.
Fun Projects
- Classroom treasure hunt: Caesar clues leading to the next location.
- Escape room: Combine a Caesar shift with Morse Code.
- Secret notes: Encrypt, then flip with Reverse Text.
- Double disguise: Encrypt, then convert to Binary.
- Playground version: Mix with Pig Latin.
What Experts Say
Cryptography courses — including popular university introductions — often begin with the Caesar cipher because it teaches the core ideas of keys, key space, and brute-force attacks in minutes.
Where Classical Ciphers Are Heading
Classical ciphers are obsolete for real security, but they're booming in education, escape rooms, and puzzle games. We predict Caesar ciphers will remain the most common "first cipher" taught worldwide — the "Hello, World!" of cryptography.