Classic Cipher Toolkit
Encode and decode classic ciphers — ROT13, Caesar, Vigenere, Atbash, rail fence and more — for puzzles, teaching and understanding why none of them are secure.
Classic pen-and-paper ciphers, for puzzles and teaching. These are historical and offer no real security — use the Text Encryptor if you need to protect something.
Three of these undo themselves, for two different reasons
ROT13, ROT47 and Atbash all return what you started with when run twice. That is why none of them has a decode button — the encode button is the decode button.
| Transform | Applied twice gives the input back? |
|---|---|
| ROT13 | yes |
| ROT47 | yes |
| Atbash | yes |
| ROT5 | no |
| ROT1 | no |
Sweeping every shift shows why. On 26 letters only 0 and 13 are self-inverse; on the 94 printable ASCII characters from "!" to "~", only 0 and 47. Thirteen is half of 26; forty-seven is half of 94. ROT47 is not a bigger, cleverer cipher — it is ROT13 with a bigger alphabet, and the odd-looking 47 is the same halfway point.
Atbash gets there a different way
ROT13 is a half turn: x becomes x + 13, so twice around is x + 26, which is x. Atbash is a mirror: x becomes 25 − x, so twice reflected is 25 − (25 − x), also x. Both are involutions; a rotation and a reflection are different animals.
The difference shows in whether they commute, and they do not — atbash(rot(x, 5)) is not rot(atbash(x), 5). It is rot(atbash(x), −5): a reflection flips the sign of any rotation it passes through.
| Reflect+p, then reflect+q | Composes to | q − p mod 26 |
|---|---|---|
| p = 3, q = 8 | ROT5 | 5 |
| p = 0, q = 13 | ROT13 | 13 |
| p = 5, q = 5 | ROT0 | 0 |
| p = 11, q = 2 | ROT17 | 17 |
Two reflections always compose into a rotation of exactly q − p. Set p = q and that rotation is ROT0 — which means every reflect-and-shift is its own inverse, all 26 of them, not only Atbash. Reflections are generous that way; among the rotations only two of 26 manage it.
So the shifts are a group, with 25 useful keys
Shifting by a and then by b is the same as shifting by a + b — checked across all 676 pairs, 0 failures. That makes the shifts a cyclic group of order 26, which is a formal way of saying there is nowhere to hide: 25 keys worth trying, since one of the 26 is the identity, and an attacker can work through them by hand over a coffee. That is the honest security claim for everything here. These are puzzle ciphers; their value is that they are reversible and fun, not that they keep anything from anyone.
And Morse could never have been unambiguous
Strip the gaps out of Morse and it stops being readable. That is usually told as a quirk. It is structural, and the reason is countable. A code is decodable without separators when no symbol's code starts another's — and Morse assigns every short code there is:
| Code length | Possible | Used | Letters |
|---|---|---|---|
| 1 | 2 | 2 | e t |
| 2 | 4 | 4 | a i m n |
| 3 | 8 | 8 | d g k o r s u w |
| 4 | 16 | 12 | b c f h j l p q v x y z |
Every code of three symbols or fewer is taken. Once "." is a letter, every longer code starting with a dot has a letter as its prefix — and 56 ordered pairs of letters stand in that relationship. There was no choice: 14 short codes exist and there are 26 letters to place.
| Word | Run together | Valid readings |
|---|---|---|
| e | . | 1 |
| eee | ... | 4 |
| sos | ...---... | 192 |
| help | ......-...--. | 2,764 |
| hello | ......-...-..--- | 19,796 |
So the gap between letters is not formatting — it is most of the message. How well Morse matched code length to letter frequency is a separate question, and it is worked through on this site's Morse code translator.
How to use
- Choose a cipher and enter your text.
- Set the key or shift where the cipher needs one.
- Read the encoded or decoded result.
- Use these for puzzles, never for real secrets.
Frequently asked questions
Are any of these ciphers secure?
None of them, against anything more than a casual reader. Every cipher here was broken long ago, most of them centuries ago, and all fall quickly to frequency analysis or exhaustive search. They are historical and recreational, and using one to protect real information would be a serious mistake.
What is an Atbash cipher?
A substitution where the alphabet is reversed — A becomes Z, B becomes Y. It has no key at all, so it is not so much broken as never secure. It appears in the Hebrew Bible, which makes it one of the oldest ciphers on record.
How does a rail fence cipher work?
By transposition rather than substitution. The text is written diagonally across a set number of lines and then read off row by row, so the letters are the same but their order changes. Because the letter frequencies are unchanged, it is immediately recognisable as a transposition.
Why was the Vigenere cipher called indecipherable?
Because using a repeating keyword means the same letter encrypts differently depending on its position, which defeats simple frequency analysis. It held that reputation for around three centuries until Kasiski published a method in 1863 for recovering the key length from repeated patterns, after which the rest follows.
What is the difference between substitution and transposition?
Substitution replaces each letter with another; transposition keeps the letters and rearranges them. Frequency analysis breaks substitution because letter frequencies survive; it identifies transposition for the same reason, since the frequencies match ordinary text exactly while the words do not.
Is there any classical cipher that is actually unbreakable?
The one-time pad, provably so — but only under conditions that make it impractical. The key must be truly random, as long as the message, used exactly once, and shared securely in advance. If you can share a key that long securely, you could have shared the message the same way.
🔒 This tool runs entirely in your browser. Nothing you enter is uploaded, logged, or stored.