Caesar Cipher
Encode, decode, and crack the classic Caesar shift cipher. Choose any shift from 1 to 25, jump to ROT13, ROT5, or ROT47, or let Crack mode try all 25 shifts and auto-detect the most likely one. Everything runs in your browser.
Shift
Enter text above to see the result here.
Alphabet mapping
Plain
Cipher
How to use Caesar Cipher
- 1
Choose encode, decode, or crack
Encrypt plain text into ciphertext, decrypt ciphertext back into plain text, or switch to Crack to break a message when you do not know the shift.
- 2
Pick a shift or a preset
Set any shift from 1 to 25 with the plus and minus buttons, or tap a preset: ROT13 for the classic letter shift of 13, ROT5 for digits, or ROT47 for all printable symbols.
- 3
Enter your text
Type or paste your message. The cipher runs automatically as you type, shifting each letter along the alphabet by the amount you set while numbers and punctuation pass through.
- 4
Crack a message without the key
In Crack mode, paste the ciphertext and the tool decodes it with all 25 shifts, then uses letter-frequency analysis to highlight the most likely plain text for you.
- 5
Copy, download, or share
Copy the result to your clipboard, download it as a text file, or share a link that reopens the tool with your exact text and settings ready to go.
Understanding the Caesar Cipher
What is the Caesar cipher?
The Caesar cipher is a substitution cipher that encrypts a message by shifting every letter a fixed number of places along the alphabet. It is named after the Roman general Julius Caesar, who reportedly used a shift of three to protect his private and military correspondence. Because each letter is always replaced by the same substitute, the Caesar cipher is the simplest and most widely taught example of classical cryptography, and it remains a perfect starting point for learning how encryption works.
Today the Caesar cipher turns up in puzzles, escape rooms, capture-the-flag challenges, and beginner programming exercises. Its most famous variant, ROT13, is still used across the web to hide spoilers, punchlines, and answers in plain sight.
How Caesar cipher encryption works
To encrypt, you pick a shift value, called the key, between 1 and 25. Each letter of your message then moves forward through the alphabet by that many positions, wrapping around from Z back to A when it runs off the end. Decryption reverses the process, shifting each letter backward by the same amount. Spaces, digits, and punctuation are normally left untouched, which is why the shape and length of the original message stay visible in the ciphertext.
For example, with a shift of three the letter A becomes D, B becomes E, and the word HELLO turns into KHOOR. To read the message, the recipient only needs to know the single shift value and move every letter three places back.
Worked example: a shift of three
Take the classic phrase ATTACK AT DAWN and apply Caesar's own shift of three. A maps to D, T maps to W, C maps to F, K maps to N, and so on, producing the ciphertext DWWDFN DW GDZQ. Notice that the spaces stay in place and repeated letters always encrypt to the same character, so the double T in ATTACK becomes a double W. Reversing the shift turns DWWDFN DW GDZQ straight back into ATTACK AT DAWN.
The Caesar cipher formula
Mathematically, each letter is treated as a number from 0 to 25, where A is 0 and Z is 25. Encryption is written as E(x) = (x + n) mod 26 and decryption as D(x) = (x - n) mod 26, where x is the letter's position and n is the shift. The mod 26 operation is what makes the alphabet wrap around, so shifting Y by three lands on B instead of running past the end of the alphabet.
ROT13, ROT5, and ROT47 explained
ROT13 is a Caesar cipher locked to a shift of thirteen. Because thirteen is exactly half of twenty-six, applying ROT13 twice returns the original text, so a single operation both encodes and decodes. ROT5 applies the same idea to the ten digits 0 through 9, which makes it handy for masking numbers, while ROT47 rotates all 94 printable ASCII characters together, scrambling letters, digits, and punctuation at once. Each of these is self-inverse, which is exactly what makes them so convenient for quickly hiding and revealing short pieces of text.
How to break a Caesar cipher
The Caesar cipher has only 25 possible keys, which makes it trivially easy to break. The most direct method is a brute-force attack: decode the message with every shift from 1 to 25 and read whichever result makes sense. A smarter approach is frequency analysis, which compares the letter distribution of each candidate against the typical frequencies of English, where E, T, and A are the most common letters, and picks the closest match automatically. The Crack mode in this tool does both for you, listing all 25 decodings and highlighting the most likely answer using a chi-squared score.
A short history of the Caesar cipher
The cipher takes its name from Julius Caesar, who according to the historian Suetonius shifted each letter three places to keep his messages private around 50 BC. His successor Augustus is said to have used a similar scheme with a shift of one. For centuries a simple letter shift was secure enough, mostly because so few people could read, let alone analyse a coded message. Its weakness was understood by the ninth century, when the Arab mathematician Al-Kindi described frequency analysis, the very technique that breaks the cipher in seconds today.
Is the Caesar cipher secure?
No. With only 25 keys, a Caesar cipher can be broken by hand in a couple of minutes and by a computer instantly, so it offers no protection for anything that genuinely needs to stay secret. Its value today is educational and recreational: it is an ideal way to learn the vocabulary of cryptography, such as plaintext, ciphertext, key, encryption, and cryptanalysis, and a fun building block for puzzles, games, and coding projects. For real security, modern algorithms such as AES are used instead.
Caesar cipher chart: all 25 shifts
This reference chart lists the ciphertext alphabet for every Caesar shift from 1 to 25. Find your shift in the left column, then read across: the row shows what the plain letters A through Z turn into. The highlighted row is ROT13, the shift of 13 that both encodes and decodes.
| Shift | Cipher alphabet (A to Z) |
|---|---|
| 1 | BCDEFGHIJKLMNOPQRSTUVWXYZA |
| 2 | CDEFGHIJKLMNOPQRSTUVWXYZAB |
| 3 | DEFGHIJKLMNOPQRSTUVWXYZABC |
| 4 | EFGHIJKLMNOPQRSTUVWXYZABCD |
| 5 | FGHIJKLMNOPQRSTUVWXYZABCDE |
| 6 | GHIJKLMNOPQRSTUVWXYZABCDEF |
| 7 | HIJKLMNOPQRSTUVWXYZABCDEFG |
| 8 | IJKLMNOPQRSTUVWXYZABCDEFGH |
| 9 | JKLMNOPQRSTUVWXYZABCDEFGHI |
| 10 | KLMNOPQRSTUVWXYZABCDEFGHIJ |
| 11 | LMNOPQRSTUVWXYZABCDEFGHIJK |
| 12 | MNOPQRSTUVWXYZABCDEFGHIJKL |
| 13 · ROT13 | NOPQRSTUVWXYZABCDEFGHIJKLM |
| 14 | OPQRSTUVWXYZABCDEFGHIJKLMN |
| 15 | PQRSTUVWXYZABCDEFGHIJKLMNO |
| 16 | QRSTUVWXYZABCDEFGHIJKLMNOP |
| 17 | RSTUVWXYZABCDEFGHIJKLMNOPQ |
| 18 | STUVWXYZABCDEFGHIJKLMNOPQR |
| 19 | TUVWXYZABCDEFGHIJKLMNOPQRS |
| 20 | UVWXYZABCDEFGHIJKLMNOPQRST |
| 21 | VWXYZABCDEFGHIJKLMNOPQRSTU |
| 22 | WXYZABCDEFGHIJKLMNOPQRSTUV |
| 23 | XYZABCDEFGHIJKLMNOPQRSTUVW |
| 24 | YZABCDEFGHIJKLMNOPQRSTUVWX |
| 25 | ZABCDEFGHIJKLMNOPQRSTUVWXY |
Frequently asked questions
What is the Caesar cipher?
What is ROT13?
What are ROT5 and ROT47?
How do I decode a message without knowing the shift?
How does the automatic solver work?
Does it change numbers, spaces, or punctuation?
What is the Caesar cipher formula?
How many shifts are possible, and is it secure?
Why did Julius Caesar use a shift of three?
Is my text uploaded to a server?
How do I know if a message is a Caesar cipher?
What is the difference between the Caesar cipher and ROT13?
What is the difference between the Caesar cipher and the Vigenère cipher?
Can you show some Caesar cipher examples with answers?
What other names does the Caesar cipher have?
How do I write a Caesar cipher in code?
Related tools
Keep going with these handy tools