A Caesar cipher calculator shifts the letters of a message by a fixed number of places, and reads it back. It also does ROT13, the Vigenère cipher with a key word, and a try-all mode that shows every possible shift, which is the way to solve a Caesar puzzle. Type your text, choose the cipher and press the button. It keeps the case of the letters and leaves punctuation as it is. It runs in your browser, and nothing that you type is sent anywhere.
How to use the Caesar cipher calculator
- Choose encrypt, decrypt, ROT13, try all shifts or the Vigenère options.
- Type or paste the text.
- Enter the shift, or the key word.
- Press Convert.
What the Caesar cipher is
The Wikipedia article on the Caesar cipher describes it as a cipher in which each letter in the plaintext is replaced by a letter some fixed number of positions along the alphabet. Its example is a left shift of 3, so that D becomes A and E becomes B. The article says that, according to the Roman historian Suetonius, Julius Caesar used it with a shift of three, with A becoming D when encrypting, and the reverse when decrypting.[1] With a shift of 3, HELLO becomes KHOOR, and KHOOR becomes HELLO when decrypted with the same shift. The calculator keeps the case, so Hello, World! becomes Khoor, Zruog!
The formula
The page numbers the letters from A = 0 to Z = 25 and gives the encryption of a letter x with a shift n as Eₙ(x) = (x + n) mod 26, and the decryption as Dₙ(x) = (x − n) mod 26.[1] The remainder keeps the result inside the alphabet, so that X, Y and Z with a shift of 3 become A, B and C. The page notes that some programming languages need the form (((x − n) mod 26) + 26) mod 26 for decryption, since they give a negative result for a negative remainder, as JavaScript does.[1] The calculator uses the form that always gives a letter. The rule is shown below the result, with your shift.
ROT13
The article on ROT13 describes it as a simple letter substitution cipher that replaces a letter with the 13th letter after it in the Latin alphabet, and as a special case of the Caesar cipher. Because there are 26 letters and 26 = 2 × 13, the ROT13 function is its own inverse, so ROT13 applied twice gives back the original text.[3] Hello becomes Uryyb, and Uryyb becomes Hello. It is often used to hide spoilers and puzzle answers in online forums, and the page says that it is not intended to be used where secrecy is of any concern, and that it is easily broken by frequency analysis.[3] Choose ROT13 and the calculator needs no shift.
Breaking a Caesar cipher
The Caesar cipher has only a limited number of possible shifts, 25 in English, so you can try them all. The page's example is the ciphertext exxegoexsrgi, which becomes attackatonce at a shift of 4.[1] The try-all mode of the calculator decrypts your text with each of the 25 shifts, and lists them with their numbers. You read down the list until one line makes sense. The page also names frequency analysis as a method, in which the common letters of English, such as E and T, are matched to the most common letters of the ciphertext.[1] For a long message, this finds the shift at once.
The Vigenère cipher
The Vigenère cipher uses a key word to apply a different Caesar shift to each letter. The article gives the encryption as Cᵢ = (Mᵢ + Kᵢ) mod 26 and the decryption as Mᵢ = (Cᵢ − Kᵢ) mod 26, with the key repeated to the length of the message.[2] Its examples include the message helloworld with the key key, which gives rijvsuyvjn, and attacking tonight with the key oculorhinolaryngology, which gives ovnlqbpvt hznzeuz.[2] With the key LEMON, the message ATTACKATDAWN becomes LXFOPVEFRNHR, which you can check by adding the letters one by one. The calculator applies the key to letters only, so spaces and punctuation do not use up a letter of the key, and it keeps the case.
Why the Vigenère cipher is stronger, and how it is broken
Because the shift changes with each letter, the same plaintext letter can give different ciphertext letters, which hides the frequencies of letters that break a Caesar cipher. For centuries, it was called the indecipherable cipher. The page explains that it can be broken by finding the length of the key, with the Kasiski examination, the Friedman test or brute force over the key lengths, after which each column of letters is a Caesar cipher that can be solved by frequency analysis.[2] So the Vigenère cipher is stronger than the Caesar cipher, but it is still far from secure by modern standards, and it is only suited to puzzles and learning.
Fun uses
These ciphers are good for games, escape rooms, geocaching and classroom lessons. A teacher can give a class a message with a Caesar shift, and the class can use the try-all mode, or crack it by hand. You can send a friend a coded note and tell them the shift. Remember that spaces and punctuation give hints, so a puzzle maker may remove them, or group the letters in fives.
Common mistakes
- Decrypting with the wrong direction. Use decrypt with the same shift that was used to encrypt.
- Using a shift of 26. It does nothing, so the range is 0 to 25.
- Using a key with digits. The key is made of letters only.
- Trusting the cipher. None of these can protect real secrets.
What next
Use this often? Add Caesar Ciphe to your Home screen.
Frequently asked questions
What is a Caesar cipher calculator?
A tool that shifts each letter of a message by a fixed number of places in the alphabet to encrypt it, and shifts back to decrypt it.
How does the Caesar cipher work?
Each letter is replaced by the one a fixed number of places along. With a shift of 3, A becomes D and HELLO becomes KHOOR.
What is ROT13?
A Caesar cipher with a shift of 13. Because 13 is half of 26, applying it twice gives back the original text.
How do I break a Caesar cipher?
Try all 25 shifts and read the one that makes sense, or use frequency analysis. The calculator's try-all mode lists them.
What is the Vigenère cipher?
A cipher that applies a different Caesar shift to each letter, using a repeating key word. The key LEMON turns ATTACKATDAWN into LXFOPVEFRNHR.
Was this tool helpful?
What went wrong?
We only receive the reason you pick, never what you typed into the tool.
Thanks for your feedback.