Caesar Cipher Decoder
Letter key
Bars show how often each letter appears in your message. Lines mark normal English.
Cipher wheel
Drag the inner ring to turn it. Outer ring: plain letters. Inner ring: coded letters.
Every possible shift
Paste a message above to see all 26 readings, most likely first.
Shortcuts: Alt + ↑ / ↓ changes the shift, Ctrl + Enter runs when Live is off. Everything happens in your browser. Your text is never uploaded.
A Caesar cipher decoder, or Caesar cipher translator, turns a shifted message back into plain text. Paste the ciphertext and the decoder moves every letter back by the shift value. Don't know the shift? The solver tries all 25 keys and ranks them by how much each result looks like English.
- Shift controlSlider, number box, presets and wheel
- Input boxPaste ciphertext or plaintext
- Output boxUpdates as you type
- Letter keyEach plain letter above its coded letter
- Ranked shiftsAll 26 shifts, best match first
What Is the Caesar Cipher?
The Caesar cipher is a substitution cipher that replaces each letter with the letter a fixed number of positions further along the alphabet. That number is the key, called the shift value. With a shift of 3, A becomes D, B becomes E, and Z wraps around to C.
- Cipher type
- Substitution
- Possible keys
- 25
- Classic shift
- 3
- First used
- 1st century BC
The Caesar cipher is one of the oldest known ciphers in cryptography. It takes its name from Julius Caesar, the Roman general who used it in his private letters. Other names for it:
Caesar shiftCaesar codeShift cipherCaesar cipher translator
How to Use the Caesar Cipher Decoder
To use the Caesar cipher decoder, pick a task below. The result updates as you type.
Decode with a Known Shift
- Select Decode.
- Paste the ciphertext.
- Set the shift with the slider, buttons or wheel.
- Copy the plaintext.
Decode without the Key
- Leave Auto-detect on.
- Paste the ciphertext.
- Read the result and its likelihood score.
- Open "Show all 26 shifts" and click a row if the result looks wrong.
Encode a Message
- Select Encode.
- Type your plaintext.
- Set the shift and share it with the reader.
- Copy the ciphertext or a share link.
Alphabet, Case and Spacing Options
The decoder has 4 settings:
OnOff
Updates on every keystroke. Turn it off and press Run, or Ctrl + Enter, for long texts.
A to ZA to Z + 0 to 9Custom
Sets which characters shift: 26 letters, 36 characters or your own alphabet.
KeepABCabc
Keeps the original case, or converts the output to uppercase or lowercase.
Keep allSpaces onlyRemove
Keeps every character, keeps spaces only, or outputs letters only.
How the Caesar Cipher Works
The Caesar cipher moves every letter of the plaintext the same number of places along the alphabet. Letters past Z wrap back to A. Spaces, digits and symbols stay unchanged in the standard version.
- 1Number the letterX = 23
- 2Add the shift23 + 3 = 26
- 3Wrap with mod 2626 → 0 = A
The Caesar Cipher Formula
The Caesar cipher formula is E(x) = (x + n) mod 26 for encryption and D(x) = (x − n) mod 26 for decryption.
- x
- Letter position: A = 0, B = 1, up to Z = 25
- n
- Shift value, from 0 to 25
- mod 26
- Keeps the remainder after dividing by 26 (modulo)
X (23) + 3 = 2626 mod 26 = 0X becomes A
C (2) − 3 = −1−1 + 26 = 25C becomes Z
Try the formula
X = 23+ 3 =26mod 26 =0→A
Example: HELLO WORLD with Shift 3
HELLO WORLD with a shift of 3 becomes KHOOR ZRUOG. To decode it, move each letter 3 places back. Type your own word or move the shift:
| Plaintext | H | E | L | L | O | W | O | R | L | D | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| Shift 3 | K | H | O | O | R | Z | R | U | O | G |
The Caesar Cipher Wheel
A Caesar cipher wheel is 2 alphabet rings, one inside the other. Turn the inner ring by the shift value, and each outer letter sits next to its coded letter. Decoder rings and classroom cipher disks use the same design. The wheel in this tool turns as you change the shift.
Caesar Cipher Chart: All 25 Shifts
The Caesar cipher chart lists the coded alphabet for each of the 25 shifts. To encode, read each plain letter (A to Z) against the letter below it in your shift's row. To decode, go the other way. Press "Use" to load a shift into the decoder.
| Shift | A becomes | ABCDEFGHIJKLMNOPQRSTUVWXYZ | Load |
|---|---|---|---|
| 1 | B | BCDEFGHIJKLMNOPQRSTUVWXYZA | |
| 2 | C | CDEFGHIJKLMNOPQRSTUVWXYZAB | |
| 3Caesar | D | DEFGHIJKLMNOPQRSTUVWXYZABC | |
| 4 | E | EFGHIJKLMNOPQRSTUVWXYZABCD | |
| 5 | F | FGHIJKLMNOPQRSTUVWXYZABCDE | |
| 6 | G | GHIJKLMNOPQRSTUVWXYZABCDEF | |
| 7 | H | HIJKLMNOPQRSTUVWXYZABCDEFG | |
| 8 | I | IJKLMNOPQRSTUVWXYZABCDEFGH | |
| 9 | J | JKLMNOPQRSTUVWXYZABCDEFGHI | |
| 10 | K | KLMNOPQRSTUVWXYZABCDEFGHIJ | |
| 11 | L | LMNOPQRSTUVWXYZABCDEFGHIJK | |
| 12 | M | MNOPQRSTUVWXYZABCDEFGHIJKL | |
| 13ROT13 | N | NOPQRSTUVWXYZABCDEFGHIJKLM | |
| 14 | O | OPQRSTUVWXYZABCDEFGHIJKLMN | |
| 15 | P | PQRSTUVWXYZABCDEFGHIJKLMNO | |
| 16 | Q | QRSTUVWXYZABCDEFGHIJKLMNOP | |
| 17 | R | RSTUVWXYZABCDEFGHIJKLMNOPQ | |
| 18 | S | STUVWXYZABCDEFGHIJKLMNOPQR | |
| 19 | T | TUVWXYZABCDEFGHIJKLMNOPQRS | |
| 20 | U | UVWXYZABCDEFGHIJKLMNOPQRST | |
| 21 | V | VWXYZABCDEFGHIJKLMNOPQRSTU | |
| 22 | W | WXYZABCDEFGHIJKLMNOPQRSTUV | |
| 23 | X | XYZABCDEFGHIJKLMNOPQRSTUVW | |
| 24 | Y | YZABCDEFGHIJKLMNOPQRSTUVWX | |
| 25 | Z | ZABCDEFGHIJKLMNOPQRSTUVWXY |
How to Decode a Caesar Cipher without the Key
To decode a Caesar cipher without the key, use 1 of 3 cryptanalysis methods:
Brute Force
Brute force means trying all 25 shifts and picking the one that reads as real words. A person tests every shift by hand in about 10 minutes. A computer does it in under a millisecond. Move the slider to try it on WKH TXLFN EURZQ IRA:
Try brute force by hand
WKH TXLFN EURZQ IRA
WKH TXLFN EURZQ IRA
Move the slider. Each dot marks a shift you have tried.
Frequency Analysis
Frequency analysis finds the shift by matching the most common ciphertext letter to the most common English letter. The Arab scholar Al-Kindi described the method in the 9th century.
Most common English letters
Find the shift in 3 steps
- Count each letter in the ciphertext.
- Take the most common one, for example H.
- Count its distance to E: H (7) − E (4) = shift 3.
Automated solvers score each shift against the full English letter table with the chi-squared statistic. The lowest score wins. This decoder adds points for common words such as "the" and "and".
Line up the letter frequencies
Chi-squared: –
The message is a pangram encoded with an unknown shift. Slide until the message bars match the English bars. The lowest chi-squared score marks the right shift.
Known-Plaintext Attack
A known-plaintext attack finds the shift from 1 letter you already know. Short words like THE, AND, OF and TO make the best guesses, called cribs.
- Guess a crib. A ciphertext that starts with WKH often hides THE.
- Subtract the plain letter from the coded letter: W (22) − T (19) = 3.
- Test shift 3 on the rest of the message.
Find a shift from 1 letter
(22 − 19) mod 26 =3
Why Short Messages Are Hard to Decode
A few letters don't carry enough frequency data. A 5-letter word can turn into a real English word at 2 or 3 different shifts. The top result is usually right once a message has about 25 letters.
4 tips for short messages
- Check the top 3 results in the shift list, not only the first.
- Try ROT13 first in CTF challenges.
- Look for names, places and numbers that fit your context.
- Try a Vigenère solver if no shift gives readable text.
ROT13: The Caesar Cipher with a Shift of 13
ROT13 is a Caesar cipher with a fixed shift of 13. The English alphabet has 26 letters, so 2 shifts of 13 bring each letter back to the start. The same step encodes and decodes:
HELLO⇄URYYB
Usenet forums used ROT13 in the early 1980s to hide spoilers, puzzle answers and jokes. Press the ROT13 button in the tool to set the shift to 13.
Hide and reveal a spoiler
Gur ohgyre qvq vg.
This line is a spoiler hidden with ROT13. Press the button to read it.
ROT13 has 3 related variants:
Numbers, Punctuation and Non-English Letters
The alphabet decides which characters shift. Characters outside it stay unchanged.
Uppercase and Lowercase Letters
Each case shifts within its own alphabet. "Hello" with shift 3 becomes "Khoor". Set Letter case to ABC or abc to convert the output.
Spaces, Numbers and Punctuation
These pass through with the A to Z alphabet. Pick A to Z + 0 to 9 to shift digits: Z moves on to 0. Pick Remove for letters only, like WKHTXLFNEURZQIRA.
Accented and Non-English Letters
Letters such as é, ü, ñ and Ą stay unchanged by default. Choose Custom and type the full alphabet in order to shift them.
| Alphabet | Letters | How to shift it |
|---|---|---|
| Basic (A-Z) | 26 | Default setting |
| A to Z plus 0 to 9 | 36 | Alphabet menu |
| Spanish | 27 (adds Ñ) | Custom alphabet |
| German | 30 (adds Ä, Ö, Ü, ß) | Custom alphabet |
| Polish | 32 (adds Ą, Ć, Ę, Ł, Ń, Ó, Ś, Ź, Ż; drops Q, V, X) | Custom alphabet |
| French | 26 plus accents such as é and ç | Custom alphabet, or replace accents first |
Auto-detect scores results against English. For other languages, check the ranked list by eye.
History of the Caesar Cipher
The Caesar cipher dates to the 1st century BC. Roman historian Suetonius recorded the method in The Lives of the Twelve Caesars around AD 121.
- 1st century BCJulius Caesar shifts letters by 3
- AD 121Suetonius records the method
- 9th centuryAl-Kindi describes frequency analysis
- 16th centuryThe Vigenère cipher uses many shifts
- 1915The Russian army uses a Caesar cipher
- Early 1980sUsenet adopts ROT13 for spoilers
- 2006Provenzano's number cipher is broken
Why Is It Called the Caesar Cipher?
Julius Caesar replaced each letter with the letter 3 places later. Suetonius wrote that Caesar put D in place of A whenever a letter held something confidential.
Augustus and Later Variants
Augustus, Caesar's heir, used a shift of 1 and wrote AA for X without wrapping. Sicilian Mafia boss Bernardo Provenzano used a number-based variant until his arrest in 2006.
Is the Caesar Cipher Secure?
No, the Caesar cipher is not secure. It fails for 3 reasons:
The Caesar cipher has the smallest key space of any common cipher:
Bar length uses a log scale.
The index of coincidence of English text stays at about 0.066 after any Caesar shift. Code breakers use that number to tell a single-shift cipher from a Vigenère cipher. Use the Caesar cipher for teaching and puzzles. Protect passwords and private data with the Advanced Encryption Standard (AES).
Caesar Cipher Uses
The Caesar cipher has 5 common uses today:
Caesar Cipher Decoder in Python and Pseudocode
A Caesar cipher decoder takes 12 lines of Python. The function shifts letters, keeps the case and leaves other characters alone:
def caesar(text, shift, decode=False):
if decode:
shift = -shift
result = []
for ch in text:
if ch.isupper():
result.append(chr((ord(ch) - 65 + shift) % 26 + 65))
elif ch.islower():
result.append(chr((ord(ch) - 97 + shift) % 26 + 97))
else:
result.append(ch)
return "".join(result)
print(caesar("HELLO WORLD", 3)) # KHOOR ZRUOG
print(caesar("KHOOR ZRUOG", 3, True)) # HELLO WORLDThe Caesar cipher algorithm in pseudocode:
FOR each character c in text
IF c is a letter
x = position of c (A = 0)
y = (x + shift) mod 26 // use x - shift to decode
output the letter at position y, in the case of c
ELSE
output c
END FORIn JavaScript, Java and C, the % operator returns a negative number for negative input. Wrap the result to keep decoding correct:
const mod = (n) => ((n % 26) + 26) % 26;
const decodeLetter = (x, shift) => mod(x - shift);Related Ciphers and Tools
The Caesar cipher is the starting point for 7 related classical ciphers:
Frequently Asked Questions
Is the Caesar cipher always a shift of 3?
▼
No, the Caesar cipher works with any shift from 1 to 25. A shift of 3 is the classic example, since Suetonius recorded that Julius Caesar used 3. Augustus used a shift of 1.
How do you write "I love you" in Caesar cipher?
▼
"I love you" with a shift of 3 is "L oryh brx". Each letter moves 3 places forward: I to L, L to O, O to R, V to Y, E to H, Y to B and U to X. A different shift gives a different result.
What is the difference between the Caesar cipher and ROT13?
▼
ROT13 is one Caesar cipher with a fixed shift of 13, and the Caesar cipher covers all 25 shifts. ROT13 decodes itself: applying ROT13 twice returns the original text.
Is the Caesar cipher symmetric or asymmetric?
▼
The Caesar cipher is symmetric. The same key, the shift value, encrypts and decrypts the message. Decryption moves letters back by the shift that encryption moved them forward.
What are other names for the Caesar cipher?
▼
The Caesar cipher has 5 other names: Caesar shift, Caesar code, shift cipher, additive cipher and rotation (ROT) cipher. "Additive cipher" comes from the formula, which adds the key to each letter's position.
When was the Caesar cipher invented?
▼
The Caesar cipher was in use by the 1st century BC, when Julius Caesar wrote with it during his campaigns. Older shift systems may exist, but Caesar's letters are the earliest recorded use.
How long does a message need to be for auto-detect to work?
▼
Auto-detect works best on messages of 25 letters or more. Messages under 10 letters often fit several shifts, so the top result can be wrong. Check the top 3 rows in the shift list for short text.
Is my text sent to your server?
▼
No, your text is not sent to our server. The decoder runs in your browser. Share links keep the message in the part of the address after the #, which browsers don't send to a server.
Why does my decoded text still look wrong?
▼
Your decoded text looks wrong when the mode, shift or alphabet differs from the one used to encode. Check that Decode is selected, the shift matches, and the alphabet includes every coded character. Try a Vigenère solver, if no shift gives readable text.
How do you encrypt numbers with a Caesar cipher?
▼
Encrypt numbers by choosing the A to Z plus 0 to 9 alphabet, which shifts digits along with letters. ROT5 is a second option. ROT5 shifts digits only, by 5 places: 0 becomes 5 and 7 becomes 2.