Caesar Cipher Encoder and Decoder
Type your text, pick a shift and choose Encode or Decode. Each letter moves that many places along the alphabet. If you don't know the shift, tick Show all 25 shifts and look for the row that reads as English.
0 words 0 characters 0 lines
Continue with this text: Letter frequencyMorse codeReverse text
Your text stays in your browser: nothing is uploaded or stored on a server.
How to use the Caesar cipher tool
- Paste or type your text in the input box, or press Example to load a sample sentence.
- Set the Shift from 1 to 25. The default of 3 is the shift Julius Caesar used.
- Choose Encode (shift forward) to make a secret message, or Decode (shift back) to read one when you know the shift.
- Tick Shift digits too (0–9) if numbers should be hidden as well.
- Use Copy, Download .txt or Use as input on the result. If you don’t know the shift, tick Show all 25 shifts (to crack a message) instead.
The result updates as you type. Nothing is sent to a server: the shifting runs in your browser.
How the shift works
Each letter moves the chosen number of places along the alphabet. Letters at the end of the alphabet wrap around to the start, so with shift 3, X becomes A, Y becomes B and Z becomes C. Decoding moves each letter back by the same number.
The Roman historian Suetonius describes the system in his life of Julius Caesar: to read Caesar’s secret letters, “substitute the fourth letter of the alphabet, namely D, for A, and so with the others”. In other words, a shift of 3.
| Before | Shift | Direction | After |
|---|---|---|---|
Meet me at the old bridge at noon. |
3 | Encode | Phhw ph dw wkh rog eulgjh dw qrrq. |
Phhw ph dw wkh rog eulgjh dw qrrq. |
3 | Decode | Meet me at the old bridge at noon. |
ATTACK AT DAWN |
3 | Encode | DWWDFN DW GDZQ |
Veni, vidi, vici |
3 | Encode | Yhql, ylgl, ylfl |
xyz XYZ |
3 | Encode | abc ABC |
Hello |
25 | Encode | Gdkkn |
The butler did it. |
13 | Encode | Gur ohgyre qvq vg. |
Shifting forward by 25 gives the same result as shifting back by 1, because 25 + 1 = 26, a full turn of the alphabet. In the same way, decoding with shift 3 gives the same result as encoding with shift 23. A negative shift works too: encoding with −3 is the same as decoding with 3.
Exactly what changes and what doesn’t
- Only A–Z and a–z are shifted. Spaces, punctuation, symbols, line breaks and emoji stay in place, so the word lengths and sentence shape of the original are still visible.
- Case is kept. An uppercase letter gives an uppercase letter:
iPhone 15 Prowith shift 3 becomeslSkrqh 15 Sur. - Accented and non-Latin letters are not shifted.
Café déjà vu, Straße, Привет 👍with shift 3 becomesFdié gémà yx, Vwudßh, Привет 👍. The é, à and ß stay as they are, and so do Cyrillic letters. - Digits are left alone by default. With Shift digits too (0–9) ticked, each digit moves along 0–9 by the same shift and wraps from 9 to 0. Shift 7 turns
Order #4471intoVykly #1148; without the option it givesVykly #4471. Because there are only ten digits, the digit shift is the remainder after dividing by 10. Shift 13 moves digits by 3 and shift 10 leaves them unchanged. - Shift 0 or an empty box gives back the text unchanged.
If someone else encoded the message, ask whether they shifted the digits. Decoding digits that were never shifted (or the other way around) turns the numbers into different numbers, while the letters still decode correctly.
Cracking a message with all 25 shifts
A Caesar cipher has only 25 useful keys, so the quickest way to read a message without the key is to try all of them. Tick Show all 25 shifts and a table appears under the result. Each row shows the text shifted back by the number in the Shift back column, from 25 down to 1. Scan the rows for the one in plain English. Its Shift back number is the key the sender used.
For Wkh vhfuhw lv lq wkh pdsoh wuhh., part of the table looks like this:
| Shift back | Text |
|---|---|
| 5 | Rfc qcapcr gq gl rfc kynjc rpcc. |
| 4 | Sgd rdbqds hr hm sgd lzokd sqdd. |
| 3 | The secret is in the maple tree. |
| 2 | Uif tfdsfu jt jo uif nbqmf usff. |
| 1 | Vjg ugetgv ku kp vjg ocrng vtgg. |
Things to know about the table:
- It always shifts your input back, whatever the Direction setting. It follows the Shift digits too option: when that is ticked, digits in each row are shifted back by the same number as the letters (wrapping within 0–9), so for
Vykly #1148the Shift back 7 row readsOrder #4471. When it is off, digits appear as they are in your input. - Each row shows the first 200 characters of the text. That is plenty to spot the right row; then set that number as the shift, choose Decode and the full message appears in the result box.
- Short messages of one or two words can read as real words under more than one shift. Try a longer piece if two rows look plausible.
If no row makes sense, the message probably isn’t a Caesar cipher. A substitution cipher that mixes up the alphabet in any order can’t be cracked by shifting. For those, count how often each letter appears with the letter frequency counter and compare the counts with the most common letters in English.
ROT13
ROT13 is the Caesar cipher with a shift of 13. Because 13 is exactly half of 26, applying it twice gives back the original, so one operation both encodes and decodes: The butler did it. becomes Gur ohgyre qvq vg., and running that through ROT13 again gives The butler did it. Set the shift to 13 and either direction gives the same output.
ROT13 was used on Usenet newsgroups from the early 1980s to hide punchlines, puzzle answers and spoilers. Readers had to choose to decode the text, so nobody saw it by accident.
With Shift digits too ticked, shift 13 moves digits by 3, which does not undo itself. For text with numbers that should round-trip under ROT13, leave the digit option off.
When people use it
- Puzzles and escape rooms. A shifted clue is easy to make and fair to solve, and the cheat sheet beside the tool doubles as a decoder card.
- Teaching. The Caesar cipher shows in a few minutes how a key works, how wrap-around (modular arithmetic) works, and why 25 possible keys are too few.
- Spoilers and answers. ROT13 hides a quiz answer or plot twist in a post or email until the reader chooses to decode it.
- Capture-the-flag challenges. When a beginner challenge hides a flag with a letter shift, the all-shifts table finds it in one step.
The cipher only hides text from a casual glance. For data that has to stay private, use real encryption. For encodings that make text safe to transmit rather than secret, see what Base64 is or turn text into binary or Morse code.
Questions
How do I decode a Caesar cipher without the key?
Paste the message and tick "Show all 25 shifts". The table lists the text decoded with every possible shift, and only one row will read as normal words. The number in its Shift back column is the key.
What is ROT13?
ROT13 is a Caesar cipher with a shift of 13. The English alphabet has 26 letters, so shifting by 13 twice brings every letter back to where it started. That is why the same step both encodes and decodes. Set the shift to 13 here; Encode and Decode give the same result.
Is the Caesar cipher secure?
No. There are only 25 possible keys, so anyone can try them all in seconds, as the "Show all 25 shifts" option does. Use it for puzzles, games, teaching and hiding spoilers, never for passwords or private data.
Does the tool keep uppercase and lowercase letters?
Yes. Uppercase letters stay uppercase and lowercase letters stay lowercase, so "Zebra" with shift 1 becomes "Afcsb". Spaces, punctuation and line breaks don't change.
What happens to numbers?
Numbers stay the same unless you tick "Shift digits too (0–9)". With that option ticked, each digit moves along 0–9 and wraps from 9 back to 0, so "4471" with shift 7 becomes "1148".
What happens to accented letters like é or ü?
They stay as they are. Only the 26 basic Latin letters A–Z and a–z are shifted, so "Café" with shift 3 becomes "Fdié". If you want accented letters to shift as well, remove the accents first with the remove accents tool.
What is a Caesar cipher wheel?
A cipher wheel is two alphabet rings, one inside the other. Turn the inner ring by the shift, then read each letter's partner on the other ring. This tool does the same thing, with the shift set in the Shift box instead of by turning a ring.