Home / Caesar cipher and ROT13 explained
Caesar cipher and ROT13 explained
Updated December 3, 2026
Two of the simplest ciphers there are. Learn how they work and why neither one keeps a secret.
The Caesar cipher
The Caesar cipher is named for Julius Caesar who, according to the Roman historian Suetonius, used it with a shift of three (A becoming D when encrypting, and vice versa when decrypting) to protect messages of military significance. Each letter moves a fixed number of places along the alphabet, and the alphabet wraps round after Z.
| Plain | Shift 3 | Shift 13 | Plain | Shift 3 | Shift 13 |
|---|---|---|---|---|---|
| A | D | N | N | Q | A |
| B | E | O | O | R | B |
| C | F | P | P | S | C |
| D | G | Q | Q | T | D |
| E | H | R | R | U | E |
| F | I | S | S | V | F |
| G | J | T | T | W | G |
| H | K | U | U | X | H |
| I | L | V | V | Y | I |
| J | M | W | W | Z | J |
| K | N | X | X | A | K |
| L | O | Y | Y | B | L |
| M | P | Z | Z | C | M |
With a shift of 3, HELLO becomes KHOOR: H→K, E→H, L→O, L→O, O→R.
Cracking it
The Caesar cipher can be broken easily even with only the coded text. Since there are only a limited number of possible shifts (25 in English), you can try each one, and the correct decryption is the one which makes sense in the language of the message. Here is KHOOR decoded with every shift:
| Shift | KHOOR read with this shift | Shift | KHOOR read with this shift |
|---|---|---|---|
| 0 | KHOOR | 13 | XUBBE |
| 1 | JGNNQ | 14 | WTAAD |
| 2 | IFMMP | 15 | VSZZC |
| 3 | HELLO | 16 | URYYB |
| 4 | GDKKN | 17 | TQXXA |
| 5 | FCJJM | 18 | SPWWZ |
| 6 | EBIIL | 19 | ROVVY |
| 7 | DAHHK | 20 | QNUUX |
| 8 | CZGGJ | 21 | PMTTW |
| 9 | BYFFI | 22 | OLSSV |
| 10 | AXEEH | 23 | NKRRU |
| 11 | ZWDDG | 24 | MJQQT |
| 12 | YVCCF | 25 | LIPPS |
Only the row for shift 3 reads as a word. The Caesar cipher tool shows this table for any text you paste.
ROT13
ROT13 is the Caesar cipher with a shift of 13. Because there are 26 letters and 26 = 2 × 13, ROT13 is its own inverse: two successive applications restore the original text. The shift-13 column of the alphabet table above is ROT13. Here are three examples:
| Text | After ROT13 |
|---|---|
| Hello, World! | Uryyb, Jbeyq! |
| ABJNM | NOWAZ |
| Uryyb, Jbeyq! | Hello, World! |
ROT13 is not intended to be used where secrecy is of any concern, since a constant shift means the encryption effectively has no key. It is mostly used to hide text from a casual glance. The ROT13 tool does it in either direction.
Worked examples
| Text | Shift | Result |
|---|---|---|
| HELLO | 3 | KHOOR |
| HELLO | 13 | URYYB |
| Attack at dawn | 5 | Fyyfhp fy ifbs |