Caesar Cipher
Encrypt or decrypt text with a Caesar shift cipher.
Was this tool helpful?
Thanks for the feedback!
The Caesar Cipher tool shifts every letter of your message a fixed number of places along the alphabet. Put the number in the Shift box (3 by default), paste your text, and press Apply cipher. A negative shift moves letters backwards, which is how you decrypt a message that was encrypted with a positive one.
The shift, written as a formula
Number the letters A = 0 to Z = 25. Encryption with key k is E(x) = (x + k) mod 26 and decryption is D(x) = (x − k) mod 26. The "mod 26" part makes the alphabet wrap around, so with a shift of 3, X becomes A, Y becomes B and Z becomes C. The tool normalises the key the same way: a shift of 29 behaves like 3, a shift of −3 behaves like 23, and 26 leaves the text unchanged.
| Plain | A B C … W X Y Z |
|---|---|
| Shift 3 | D E F … Z A B C |
A worked example
With a shift of 3, the sentence "Meet me at India Gate at 7 PM" becomes:
Phhw ph dw Lqgld Jdwh dw 7 SP
Notice what stays the same: capital letters remain capitals, lowercase stays lowercase, and the space, the digit 7 and any punctuation pass through untouched. Only the 26 English letters move; accented letters and non-Latin scripts such as Devanagari are left as they are. Paste the encrypted line back in with a shift of −3 and the original sentence returns.
Why the Caesar cipher is easy to break
The Roman historian Suetonius wrote that Julius Caesar used a shift of three for private letters. Against anyone today it offers no protection, for two reasons:
- Only 25 useful keys. An attacker can try every shift from 1 to 25 in a minute and stop at the one that produces readable words. You can do the same with this tool by changing the Shift value.
- Letter frequencies survive. E is the most common letter in English text. If the ciphertext is long and H appears most often, the shift is probably 3, because E + 3 = H.
Short words give it away too: a lone encrypted letter is almost always "a" or "I" in the original.
Good uses for it
- Teaching modular arithmetic and the idea of a key in maths or computer science lessons.
- Treasure hunts, escape rooms and puzzle clues where the solver is meant to crack it.
- Checking the output of your own Caesar program when practising Python, Java or C.
- Hiding spoilers or answers casually, the way a shift of 13 is used online; the ROT13 Encoder does that fixed shift in one click.
For anything that must actually stay secret, use real encryption, and for strong random secrets use the Password Generator rather than a shifted word.