Caesar Cipher / ROT13
Encode and decode Caesar-shift ciphers and ROT13, with a brute-force view of all 25 shifts — which is exactly why the cipher offers no real security.
Show all 26 shifts (brute force)
A hundred characters is enough to recover the key without trying one
Shifting does not change how often each letter appears, only which letter it appears as. So the frequency profile of the ciphertext is the English profile rotated by the key, and finding the key means finding the rotation that lines them up. Scoring all 26 rotations against published English letter frequencies, over 400 random passages at each length:
| Ciphertext length | Key recovered |
|---|---|
| 20 characters | 76.3% |
| 40 characters | 96.3% |
| 60 characters | 98.5% |
| 80 characters | 99.8% |
| 100 characters | 100.0% |
By 100 characters it never misses. The method never looks at the plaintext, never tries a decryption, and does not care what the message says — it only counts letters.
The twenty-character row is the interesting one. Three or four words already give the right answer three times in four. That is not a cipher failing at scale; it is a cipher that barely survives a phrase.
And the whole keyspace fits on one screen anyway
There are 26 shifts and one of them changes nothing, so 25 are useful — about 4.6 bits:
| Key | Possibilities | Bits |
|---|---|---|
| a Caesar shift | 25 | 4.6 |
| a single byte | 256 | 8.0 |
| a modern symmetric key | 3.40e+38 | 128.0 |
The panel above prints all 26 rows at once. That is not so much a demonstration of brute force as an admission that brute force here is reading a list — and the frequency method above does not even need the list.
Why ROT13 and not any other shift
ROT13 is its own inverse: apply it twice and you are back where you started. Exactly 2 shifts do this — 0 and 13 — and the reason is one line of arithmetic. A shift n is self-inverse when 2n is a multiple of 26, which happens for 0 and for 13 and for nothing else.
That is why ROT13 became the convention for hiding spoilers and puzzle answers. Not because it is stronger than shift 7 — it is exactly as weak — but because one button both hides and reveals, and nobody has to remember which direction they went.
How to use
- Enter your text and choose a shift.
- Read the encoded or decoded result.
- Use the brute-force view to break a message without the key.
- Treat this as a puzzle tool, not a security tool.
Frequently asked questions
How does a Caesar cipher work?
Each letter moves a fixed number of places along the alphabet, wrapping around at the end. With a shift of three, A becomes D and Z becomes C. Named for Julius Caesar, who reportedly used a shift of three for military correspondence.
How secure is it?
Not at all, by any modern standard. There are only 25 possible shifts, so trying them all takes moments — which is what the brute-force view here demonstrates. Even without trying every key, letter frequency gives the answer away almost immediately.
What is ROT13?
A Caesar cipher with a shift of 13. Because 13 is half of 26, applying it twice returns the original text, so the same operation both encodes and decodes. It was widely used on early internet forums to hide spoilers and punchlines from casual reading, which is the appropriate use — obscurity, not secrecy.
How do you break one without the key?
Frequency analysis. E is the commonest letter in English, so the commonest letter in the ciphertext usually corresponds to it, giving the shift directly. For short messages, simply reading all 25 candidates is faster.
What is a Vigenere cipher?
A Caesar cipher with a shifting key — each letter uses a different shift determined by a repeating keyword. It resisted casual analysis for centuries and was called the indecipherable cipher, until Kasiski showed in 1863 that the repeating key length can be recovered from repeated patterns.
Are numbers and punctuation shifted?
Conventionally no. Only letters are shifted, with digits, spaces and punctuation passing through untouched. That preserves the shape of the message, which incidentally makes it even easier to break, since word lengths remain visible.
🔒 This tool runs entirely in your browser. Nothing you enter is uploaded, logged, or stored.