How the Caesar cipher works
A Caesar cipher replaces every letter with the letter a fixed number of places further along the alphabet, wrapping from Z back to A. With a shift of 3 the alphabet lines up like this:
| Plain | ABCDEFGHIJKLMNOPQRSTUVWXYZ |
|---|---|
| Cipher | DEFGHIJKLMNOPQRSTUVWXYZABC |
The Roman historian Suetonius describes Julius Caesar writing confidential letters this way: to read them, “substitute the fourth letter of the alphabet, namely D, for A, and so with the others” (Life of Julius Caesar, 56).
Worked example: HELLO with shift 3
| Letter | Position (A = 0) | +3 | Cipher letter |
|---|---|---|---|
| H | 7 | 10 | K |
| E | 4 | 7 | H |
| L | 11 | 14 | O |
| L | 11 | 14 | O |
| O | 14 | 17 | R |
So HELLO encodes to KHOOR. In arithmetic terms, each letter at position p becomes (p + shift) mod 26, and decoding subtracts the shift instead. A shift of 29 is the same as 3, and a shift of −3 is the same as 23 — the tool accepts any whole number and reduces it for you.
Cracking a Caesar cipher
There are only 25 useful shifts, so the fastest attack is to try them all. Paste a message into the Ciphertext box and the brute-force table shows every possibility at once. Here is part of that table for the ciphertext XPPE XP LE ESP ZWO ZLV ECPP LE YZZY:
| Shift | Decoded |
|---|---|
| 9 | OGGV OG CV VJG QNF QCM VTGG CV PQQP |
| 10 | NFFU NF BU UIF PME PBL USFF BU OPPO |
| 11 | MEET ME AT THE OLD OAK TREE AT NOON |
| 12 | LDDS LD ZS SGD NKC NZJ SQDD ZS MNNM |
| 13 | KCCR KC YR RFC MJB MYI RPCC YR LMML |
Only shift 11 produces English. To save you scanning, the tool also scores each row by how typical its letters are of English and whether it contains very common English words, and stars the best match — here, shift 11. Scoring is reliable for a sentence or more; for very short messages, trust your eyes over the star.
Frequency analysis by hand
Without a computer, count the letters in the ciphertext. In ordinary English, E is the most common letter, followed by letters such as T, A and O. If the most common cipher letter is H, a shift of 3 (E → H) is a good first guess.
ROT13
ROT13 is the Caesar cipher with a shift of 13. Since 13 + 13 = 26, encoding twice returns the original text, which made ROT13 a popular way to hide spoilers and puzzle answers online: “Hello” ↔ “Uryyb”. It hides text from a casual glance, nothing more.
What gets shifted
Only the 26 basic Latin letters change. Upper and lower case are preserved, and spaces, digits, punctuation and accented letters pass through untouched, so the punctuation of a message survives. For a cipher that resists brute force a little longer, try the Vigenère cipher, which uses a different shift for each letter of a keyword, or the fixed mirror substitution of the Atbash cipher.
Make a cipher wheel
A classroom favourite is the cipher wheel: two paper discs, each printed with the alphabet around the edge, pinned together at the centre. Turn the inner disc until A sits under the outer letter for your shift — D for a shift of 3 — and read each plaintext letter on the outer ring straight across to the inner ring. Turning the wheel to every position in turn is the brute-force attack done by hand, and shows why 25 keys are far too few for real secrecy.
The same idea in code
In most programming languages the cipher is one line per letter: take the letter’s position (A = 0), add the shift, take the remainder after dividing by 26, and convert back to a letter, keeping the original case. This tool does exactly that and leaves every non-letter untouched, so Hello, World! 2026 with a shift of 3 becomes Khoor, Zruog! 2026.