The Caesar cipher is one of the oldest known encryption methods, named after Julius Caesar, who used a shift of 3 to protect military messages. It is a substitution cipher: every letter is replaced by another letter a fixed number of places further along the alphabet. This tool lets you encrypt or decrypt text with any shift from 0 to 25, instantly and entirely in your browser. It is ideal for puzzles, escape-room clues, classroom demonstrations and casual obfuscation.
How it works
Each letter is mapped onto the 26-letter alphabet as a number (A = 0 … Z = 25). The cipher adds the shift to that number, then wraps around using modulo 26:
encrypted = (letter index + shift) mod 26
Decryption subtracts the shift instead of adding it. The tool normalises the shift with ((shift % 26) + 26) % 26 so negative or large values still behave correctly, and it preserves letter case — uppercase stays uppercase, lowercase stays lowercase. Anything that is not a letter (digits, spaces, punctuation) is left exactly as typed.
Example
Encrypt HELLO with a shift of 3:
| Letter | Index | + shift 3 | mod 26 | Result |
|---|---|---|---|---|
| H | 7 | 10 | 10 | K |
| E | 4 | 7 | 7 | H |
| L | 11 | 14 | 14 | O |
| L | 11 | 14 | 14 | O |
| O | 14 | 17 | 17 | R |
The output is KHOOR. To recover the original, set the mode to Decrypt with the same shift of 3, and KHOOR becomes HELLO again.
Everything runs locally in your browser — your text is never uploaded.
Breaking a Caesar cipher without the key
Because there are only 25 possible non-zero shifts, the cipher is trivially broken by brute force — try each shift until readable text appears. A faster analytical approach is letter-frequency analysis: in English, the letter E is most common, followed by T, A, O, I and N. If the most frequent character in a ciphertext is, say, H, then H is likely standing in for E, which implies a shift of 3. Comparing the observed character distribution to the expected English distribution narrows the key rapidly.
This fragility is why the Caesar cipher is not suitable for protecting any real information. It has exactly 25 keys, and a computer can try all of them in microseconds. Its value today is entirely educational and recreational — understanding it is usually the first step toward understanding more sophisticated substitution ciphers and, eventually, modern cryptography.
Useful shifts to know
| Shift | Notable for |
|---|---|
| 3 | Julius Caesar’s reported shift |
| 13 | ROT13 — its own inverse (encrypt twice = original) |
| 1 | Off-by-one, useful for simple puzzles |
| 25 | Equivalent to a –1 reverse shift |
ROT13, shift 13, has the special property that applying the cipher twice returns the original text, because 13 + 13 = 26 ≡ 0 (mod 26). It is commonly used in online forums to hide spoilers — use this tool with a shift of 13 to encode or reveal any ROT13 message.
Use cases
Escape rooms and puzzle design. A Caesar cipher is an excellent puzzle element because solvers can crack it with pencil and paper if they spot the pattern, or use this tool to check their solution. Setting the shift to something non-obvious — 7 or 19 — adds a little more challenge than the classic shift of 3.
Teaching cryptography basics. The Caesar cipher introduces the core ideas of a key (the shift), a keyspace (25 possible values), substitution, and brute-force versus analytical attacks. These concepts carry forward directly to Vigenère ciphers, one-time pads, and symmetric block ciphers like AES.
Lightweight obfuscation of non-sensitive text. ROT13 has a long history of hiding spoilers, punchlines and mild profanity in online communities where a simple visual barrier is enough. It offers no real security but serves as a social convention that the reader has to opt in to see the content.