Caesar Cipher Encoder/Decoder
Shift letters forward or backward using the classic Caesar cipher.
Share on Social Media:
Enter some text and a shift between 1 and 25, and this tool shows the result of the Caesar cipher in both directions at once: each letter shifted forward (encode) and shifted backward (decode). Capital and lowercase letters keep their case, and numbers, spaces and punctuation are left untouched.
How the cipher works
The Caesar cipher replaces every letter with the one a fixed number of places further along the alphabet, wrapping round from Z back to A. With a shift of 3:
A B C D E F G H I J K L M N O P Q R S T U V W X Y ZD E F G H I J K L M N O P Q R S T U V W X Y Z A B C
So Hello World becomes Khoor Zruog. To decode, shift back by the same amount. Mathematically, with letters numbered 0–25, encoding is (letter + shift) mod 26 and decoding is (letter − shift) mod 26. A shift of 13 is special: it's the same in both directions, which is why ROT13 (Caesar with shift 13) is used to hide spoilers and puzzle answers. Running it twice gives back the original.
Breaking a Caesar cipher
There are only 25 useful shifts, so the cipher can be broken by simply trying them all, which takes seconds. To crack a message with this tool, paste the ciphertext and step through shifts 1 to 25, reading the "backward" output until it makes sense.
For longer messages there's an even quicker trick: frequency analysis. In English, E is by far the most common letter, followed by T, A and O. Find the most common letter in the ciphertext and assume it stands for E. If the most frequent letter is H, the shift is probably 3. This idea was described by the Arab scholar al-Kindi in the 9th century and broke every simple substitution cipher for hundreds of years.
Where it's genuinely useful today
- Teaching cryptography. It's the standard first example for keys, encryption, decryption and brute-force attacks.
- Puzzles, geocaching and escape rooms. A light layer of disguise that people can solve with a little thought.
- Coding practice. Implementing it is a classic beginner exercise in loops, character codes and modular arithmetic. Use this tool to check your program's output.
Not for real secrets
Never use a Caesar cipher (or ROT13) to protect passwords, personal data or anything sensitive. It provides no security. For real protection, use modern, well-reviewed encryption such as AES through trusted software: password managers, encrypted messaging apps, or your operating system's built-in disk encryption.