Caesar Cipher Encoder
Text Tools · Added
Named for Julius Caesar, who used it for military correspondence, the shift cipher moves every letter a fixed distance through the alphabet. Encode with any shift, decode with the same one, or — when you do not know the key, which is the usual situation with a puzzle — display all twenty-five possibilities at once and let letter frequency point at the one that reads like English.
How to use the caesar cipher encoder
- 1Choose whether you want to encode, decode, or try every shift.
- 2Paste your text into the box. Digits, spaces and punctuation pass through untouched; only letters move.
- 3For encoding and decoding, drag the shift slider or use a preset. Thirteen is ROT13.
- 4The result appears as you type — there is nothing to submit.
- 5In the try-every-shift mode, read the highlighted row first: it is the shift whose output most closely matches English letter frequencies. Then check the table, because on a short message that ranking is a hint rather than an answer.
Examples
A shift of three, as Caesar used it
- Input
- ATTACK AT DAWN with a shift of 3
- Result
- DWWDFN DW GDZQ
A becomes D, T becomes W. Word lengths and spacing survive intact, which is a large part of why the cipher is so easy to break.
ROT13, which undoes itself
- Input
- Spoiler: the butler did it, at shift 13
- Result
- Fcbvyre: gur ohgyre qvq vg
Apply ROT13 to that output and the original comes back. Thirteen is half of twenty-six, so encoding and decoding are the same operation — which is why forums adopted it for spoilers.
Cracking one without the key
- Input
- Wkh txlfn eurzq ira mxpsv ryhu wkh odcb grj, in try-every-shift mode
- Result
- Shift 3 ranks first: The quick brown fox jumps over the lazy dog
Twenty-five candidates, scored against English letter frequencies. On a full sentence the winner is usually unambiguous.
About the caesar cipher encoder
How the shift works
Line up the alphabet, then line up a second copy underneath it moved along by a fixed number of places. That is the whole cipher. With a shift of three, A sits above D, B above E, and Z wraps round to C. Encoding reads down; decoding reads up, which is the same as shifting by twenty-six minus the key.
Because the mapping is fixed for the whole message, every occurrence of a given letter becomes the same other letter. That property is the cipher's fatal weakness and also what makes it easy to teach: the substitution is visible, reversible and requires nothing but counting. It is usually the first cipher anyone meets, and it introduces ideas — key, keyspace, ciphertext, brute force — that carry all the way to modern cryptography.
The keyspace is twenty-five, not twenty-six, because a shift of zero leaves the text unchanged. That is small enough to enumerate by hand, and small enough that this page can show every possibility at once rather than asking you to guess.
Frequency analysis, and where it stops working
Even without trying all twenty-five keys, a Caesar cipher falls to counting. In ordinary English text E is by far the most common letter, followed by T, A and O; Q, X, J and Z between them account for well under one per cent. A shift moves that whole distribution along by a fixed amount without changing its shape, so finding the offset that lines the observed counts back up with the expected ones recovers the key directly.
That is what the ranking on this page does, scored with a chi-squared statistic so that a rare letter turning up frequently — the strongest evidence that a shift is wrong — counts for much more than a small wobble in a common one. On a paragraph it is essentially always right. On a four-word phrase it is a suggestion, because a handful of letters cannot establish a distribution.
This is also why the same technique, extended, breaks the more elaborate substitution ciphers that replace each letter with an arbitrary other one. The shape of the language survives the substitution. Defeating it needs a cipher where the same plaintext letter does not always produce the same ciphertext letter — the insight behind the Vigenère cipher and, in a far stronger form, behind everything that followed.
Frequently asked questions
Is a Caesar cipher secure?
What is ROT13 and why is it so common?
How does the automatic guess work?
Why did the guess pick the wrong line?
What happens to numbers, accents and punctuation?
Related tools
Morse Code Translator
Text Tools
Translate text to Morse code and back, and hear it played at a real sending speed.
Text Cleaner
Text Tools
Strip extra spaces, blank lines, line breaks, HTML tags, punctuation and smart quotes.
Case Converter
Text Tools
Convert text between upper, lower, title, sentence, camel, snake, kebab and more.