Caesar Cipher
A free tool by DeepRit, a Google Ads agency that does PPC and nothing else. We build and run Google Ads accounts so every click is accounted for. Book a free audit call
Free Caesar cipher tool. Encode and decode text with any shift, use ROT13 in one click, and crack an unknown shift by seeing all 25 possibilities.
Free, no sign-up. Runs in your browser: nothing you type is uploaded or saved.
How to use the Caesar cipher tool
- Type or paste your text.
- Set the shift, the number of places each letter moves. The classic Caesar cipher uses 3.
- Choose Encode to shift letters forward, or Decode to shift them back.
- Press ROT13 for the popular shift of 13, where encoding and decoding are the same.
- Copy the result. If you've received a message and don't know the shift, look at the table below the result: it shows your text with all 25 possible shifts, so you can spot the one that reads as plain English.
Upper and lower case are kept as they are, and numbers, spaces and punctuation are left unchanged. The Caesar cipher tool runs in your browser.
What the Caesar cipher is
The Caesar cipher is one of the oldest and simplest ways to hide a message. Each letter is replaced by the letter a fixed number of places further along the alphabet. With a shift of 3:
| Plain | A | B | C | D | … | X | Y | Z |
|---|---|---|---|---|---|---|---|---|
| Cipher | D | E | F | G | … | A | B | C |
So HELLO becomes KHOOR. At the end of the alphabet it wraps around: X becomes A, Y becomes B and Z becomes C.
It's named after Julius Caesar, who, according to the Roman historian Suetonius, used a shift of three to protect military messages. It's a type of substitution cipher, where each letter is consistently swapped for another.
How it works mathematically
Number the letters A = 0, B = 1, … Z = 25. Then, for a shift k:
- Encode: E(x) = (x + k) mod 26
- Decode: D(x) = (x − k) mod 26
The "mod 26" makes the alphabet wrap around, like a clock. Y (24) shifted by 3 is 27, and 27 mod 26 = 1, which is B. The modulo calculator explains modular arithmetic in more depth.
Decoding with shift k is the same as encoding with shift 26 − k. A shift of 26 (or 0) leaves the text unchanged, and shifts larger than 26 wrap around: a shift of 29 is the same as 3.
ROT13
ROT13 ("rotate by 13") is a Caesar cipher with a shift of 13. Because 13 is exactly half of 26, applying ROT13 twice gives back the original text, so the same operation encodes and decodes. "Hello" becomes "Uryyb", and "Uryyb" becomes "Hello".
ROT13 became popular on early internet forums and Usenet for hiding spoilers, puzzle answers and punchlines, so readers had to choose to reveal them. It's still used for the same purpose, and as a classic programming exercise. It offers no security at all.
How to crack a Caesar cipher
The Caesar cipher is very easy to break, for two reasons:
1. There are only 25 possible keys. You can simply try every shift and see which one makes sense. That's what the table in this tool does: it lists your text under all 25 shifts. One of them will read as normal language.
2. Letter frequency. In English, E is the most common letter, followed by T, A, O, I and N. If the most common letter in a long ciphertext is H, the shift is probably 3 (E → H). This technique, frequency analysis, was described by the Arab scholar al-Kindi in the 9th century and breaks any simple substitution cipher.
Why it's still useful
The Caesar cipher has no place in real security; use proper encryption for anything private. But it's a great tool for:
- Teaching: it introduces encryption, keys, modular arithmetic and code-breaking in a way anyone can follow.
- Puzzles and escape rooms: a classic clue type.
- Treasure hunts and games for children.
- Geocaching: hints are often ROT13-encoded.
- Spoilers and answers: hiding text until someone chooses to read it.
- Programming practice: a common beginner exercise.
Variations and related ciphers
- Atbash: reverses the alphabet (A ↔ Z, B ↔ Y). Like ROT13, it's its own inverse.
- Vigenère cipher: uses a keyword, so the shift changes from letter to letter. It resisted casual attack for centuries, but is breakable with the right methods.
- ROT47: shifts a wider range of printable characters, including digits and punctuation.
- Keyword substitution: a scrambled alphabet rather than a shifted one.
For other ways to transform text, try the Morse code translator, binary translator, NATO phonetic alphabet translator or reverse text generator. Base64, available in the Base64 encoder, is an encoding rather than a cipher; it isn't secret either. For real protection of data, hashing (see the hash generator) and modern encryption are the tools to use.
Caesar cipher in code
The Caesar cipher is a classic first programming exercise. The idea in any language:
- Loop through each character.
- If it's a letter, find its position in the alphabet (0 to 25).
- Add the shift, take the result mod 26, and convert back to a letter in the same case.
- Leave other characters unchanged.
In JavaScript, a common bug is that the % operator can return negative numbers, so shifting backwards needs ((x % 26) + 26) % 26 to stay in range. In Python, % already returns a positive result. The Caesar cipher tool here handles negative shifts and shifts larger than 26 correctly, so you can use it to check your program's output.
Teaching with the Caesar cipher
Teachers use the Caesar cipher to introduce:
- Keys: the shift is a secret that both people need to know.
- Key space: with only 25 possible keys, trying them all is easy, which shows why real encryption needs enormous key spaces.
- Frequency analysis: counting letters in a long message reveals the shift.
- Modular arithmetic: the wrap-around from Z to A.
A simple classroom activity: students encode a message with a secret shift, swap with a partner, and try to crack it using letter frequency or the 25-row table.
Cipher wheels
A cipher wheel (or cipher disk) has two alphabets on rings that turn against each other. Line up A on the outer ring with D on the inner ring and you have a Caesar cipher with a shift of 3. Cipher wheels were used for centuries and are easy to make from card, which makes them a popular craft activity alongside the Caesar cipher tool.
A short history of secret writing
People have hidden messages for thousands of years. Besides shifting letters, the ancient Greeks wrapped strips of leather around rods of a set thickness (the scytale), so the message only lined up on a rod of the same size. Medieval and Renaissance diplomats used substitution alphabets and codebooks. In the 20th century, mechanical cipher machines such as Enigma used rotating wheels to change the substitution with every letter, and breaking them helped shape the Second World War. Modern encryption relies on mathematics that would take computers far longer than the age of the universe to break by trying every key. Shift ciphers are where that story starts.
Breaking a shift with frequency analysis
For a longer message, count which letter appears most often. In normal English text it's very likely to stand for E. If the most common letter in the coded text is J, the shift is probably 5, because E moved forward 5 places is J. Try that shift, and if the result reads as English, you've cracked it.
A worked example
A teacher is setting a puzzle for a classroom escape room. She types "Hello, World" into the Caesar cipher tool with a shift of 3 and Encode selected. The result is "Khoor, Zruog": letters shifted, case kept, and the comma and space unchanged.
To check, she switches to Decode with shift 3, pastes "Khoor, Zruog", and gets "Hello, World" back.
For a second clue, she presses ROT13 on "Hello", giving "Uryyb". A student who doesn't know the shift can paste the code in and scan the 25-row table: row 13 reads "Hello".
Need more customers from Google?
This tool is free and runs in your browser. If your business also needs more leads or sales, Google Ads is where people search with their wallet out. That is the whole job of DeepRit: a PPC-only agency that sets up and runs Google Ads accounts so every click is accounted for. You keep full ownership of your account, get a written report every week, and can stop at any time. See our pricing or ask for a free audit.
Frequently asked questions
How does the Caesar cipher work?
Each letter is shifted a fixed number of places along the alphabet, wrapping from Z back to A. With a shift of 3, A becomes D and HELLO becomes KHOOR.
How do I decode a Caesar cipher without the key?
Try all 25 shifts and pick the one that reads as normal text. The Caesar cipher tool shows all 25 at once.
What is ROT13?
A Caesar cipher with a shift of 13. Applying it twice returns the original text, so it encodes and decodes the same way.
Is the Caesar cipher secure?
No. With only 25 possible keys, it can be broken in seconds. Use it for puzzles and learning, not for real secrets.
Does it change numbers and punctuation?
No. Only the letters A–Z and a–z are shifted; everything else stays the same.
Is the Caesar cipher tool free?
Yes. It's free, needs no sign-up, and runs in your browser.
Free PPC audit
See where your ad budget leaks.
We look at your Google Ads account before the call, then walk you through what we'd fix first, in dollars. No obligation, no hard sell.