Caesar Cipher and ROT13 - Encode, Decode and Try All 25 Shifts
Encode or decode a Caesar cipher with any shift from -25 to 25, use ROT13, or try all 25 shifts of an unknown message and see the likeliest marked.
Maintained by Hirantha Sandaruwan Lakshan. Updated 13 October 2026.
About this tool
The Caesar cipher moves every letter a fixed number of places along the alphabet. Choose a shift from -25 to 25 to encode or decode, press ROT13 for the shift of 13, or paste a message of unknown shift and look at all 25 possibilities at once, with the most English-looking line marked. It runs in your browser and nothing is sent anywhere.
How it works
How it works. Each letter moves forward by the shift and wraps from Z back to A. With a shift of 3, A becomes D, B becomes E and Z becomes C, so VENI VIDI VICI becomes YHQL YLGL YLFL. To decode, move back by the same number. ROT13 is the shift of 13; because 13 + 13 = 26, the whole alphabet, doing it twice returns the original, so the same step both encodes and decodes.
What the tool changes. Only the 26 English letters move, and upper and lower case are kept. Digits, spaces, punctuation and letters from other alphabets, such as é, ñ or Sinhala and Tamil letters, are left exactly as they are. A negative shift goes backwards, so -3 is the same as 23. Shifts beyond 25 add nothing, since a shift of 26 is a shift of 0.
Brute force. A Caesar cipher has only 25 useful keys, so the table decodes your text with every shift from 1 to 25. Each line is scored with a chi-squared statistic: for each letter A to Z take (observed count - expected count) squared, divide by the expected count, and add the 26 results. The expected count is the number of letters in the text times that letter's share of English text (E 12.702%, T 9.056%, A 8.167% and so on, from Lewand's table). The smallest total looks most like English and is marked. With under 20 letters the ranking is too weak to trust and the page says so, and a message in another language will not match English frequencies.
History. Suetonius writes in his Life of Julius Caesar (chapter 56) that for confidential letters Caesar wrote in cipher, rearranging the letters so that no word could be made out, and that a reader had to put the fourth letter, D, for A and the rest likewise. That is a shift of 3. In the Life of Augustus (chapter 88) Augustus used a shift of one and wrote AA for X. Frequency analysis, the idea behind the score above, is traced by Wikipedia to the ninth-century scholar al-Kindi.
Security. A Caesar cipher is not encryption you should rely on. With 25 keys it can be broken by hand in minutes and by a computer instantly, and the spaces and punctuation it leaves in place help the attacker. Use it for puzzles, teaching and hiding spoilers. For anything private use a modern, reviewed cipher such as AES (FIPS 197) in a tool built for the purpose.
Worked examples
Caesar's shift of three
VENI VIDI VICI with a shift of 3 becomes YHQL YLGL YLFL: V+3 = Y, E+3 = H, N+3 = Q, I+3 = L. Decode with the same shift in Decode mode to get the Latin back.
ROT13 applied twice
Hello, World! becomes Uryyb, Jbeyq! (H to U, e to r, l to y, o to b). Run ROT13 on that and you are back at Hello, World!, with the capital letters and punctuation untouched.
Cracking an unknown message
Paste Wkh dwwdfn ehjlqv dw gdzq, vr whoo wkh phq wr eh uhdgb. into the brute-force box. Moving every letter back 3 places gives The attack begins at dawn, so tell the men to be ready. Its chi-squared score is about 15, while no other shift scores below 170, so shift 3 is marked as the most likely.
A negative shift
HELLO with a shift of -3 becomes EBIIL: H-3 = E, E-3 = B, L-3 = I, O-3 = L. The same result comes from a shift of 23.
The alphabet shifted by 3 (Caesar) and by 13 (ROT13)
| Plain letter | Shift of 3 | Shift of 13 (ROT13) |
|---|---|---|
| A | D | N |
| B | E | O |
| C | F | P |
| D | G | Q |
| E | H | R |
| F | I | S |
| G | J | T |
| H | K | U |
| I | L | V |
| J | M | W |
| K | N | X |
| L | O | Y |
| M | P | Z |
| N | Q | A |
| O | R | B |
| P | S | C |
| Q | T | D |
| R | U | E |
| S | V | F |
| T | W | G |
| U | X | H |
| V | Y | I |
| W | Z | J |
| X | A | K |
| Y | B | L |
| Z | C | M |
Frequently asked questions
What shift did Julius Caesar use?
A shift of three. Suetonius, in his Life of Julius Caesar (chapter 56), says that to read Caesar's ciphered letters you put the fourth letter of the alphabet, D, for A, and the remaining letters likewise. A to D is a move of three places.
What is ROT13 and why is it its own inverse?
ROT13 is the Caesar cipher with a shift of 13. The English alphabet has 26 letters, so shifting by 13 twice moves every letter 26 places, which is all the way round. One operation therefore encodes and decodes. It is used to hide spoilers and punchlines, not to keep secrets.
How do I decode a Caesar cipher when I do not know the shift?
Try all 25 shifts and read the results, which the brute-force table does for you. It marks the line whose letter frequencies are closest to English by chi-squared score. For a sentence of about 50 letters or more that is almost always the right line; for under 20 letters the tool says the ranking is weak, so read the 25 lines yourself.
How many possible keys does a Caesar cipher have?
Twenty-five that change the text. A shift of 0 leaves it unchanged, and a shift of 26 is the same as 0, so the English alphabet gives shifts 1 to 25. That small number is why the cipher is so easy to break.
Is the Caesar cipher secure?
No. Anyone can try all 25 shifts in seconds, and the word lengths and punctuation it keeps give more clues. Treat it as a puzzle or a teaching tool. For real secrecy use a modern cipher such as AES, defined in NIST FIPS 197, through a tool designed for it.
Does it change numbers, punctuation and accented letters?
No. Only A to Z and a to z move. Digits, spaces, punctuation and letters outside the English alphabet pass through unchanged. Some other ciphers also rotate digits; this one does not.
Why does the brute-force score need enough text?
Chi-squared compares the count of each letter with what English predicts. A handful of letters can match English by luck or fail to, so the tool says the ranking is weak under 20 letters. Longer text gives a clearer result.
Is my text sent anywhere?
No. The shifting and the scoring happen in your browser and nothing is uploaded.
Sources & references
- Suetonius, Life of Julius Caesar, chapter 56, Loeb translation (checked 13 October 2026)
- Suetonius, Divus Iulius 56, Latin text (checked 13 October 2026)
- Suetonius, Life of Augustus, chapter 88, Loeb translation (checked 13 October 2026)
- English letter frequencies from Lewand, Cryptological Mathematics (2000), as reproduced by Wellesley College (checked 13 October 2026)
- Wikipedia: Caesar cipher (checked 13 October 2026)
- NIST FIPS 197, Advanced Encryption Standard (checked 13 October 2026)
Updated Oct 13, 2026