Tech & Digital
Caesar Cipher Encoder and Decoder (with ROT13)
The Caesar cipher is one of the oldest and simplest methods of encryption. Each letter of the message is replaced by the letter a fixed number of places further along the alphabet, wrapping around from Z back to A. With a shift of three, A becomes D, B becomes E and Z becomes C, so the word Hello becomes Khoor. To decode, you shift each letter back by the same amount. The cipher is named after Julius Caesar, who according to the Roman historian Suetonius used a shift of three in his private correspondence. A shift of thirteen, known as ROT13, has a special property: because the English alphabet has 26 letters, applying it twice returns the original text, so the same operation both encodes and decodes. ROT13 has long been used online to hide spoilers and puzzle answers from casual reading. This tool lets you encode or decode text with any shift from 1 to 25, keeps uppercase and lowercase letters as they are, and leaves numbers, spaces and punctuation unchanged. It also shows the first part of your text decoded with every possible shift, which is a brute-force attack: since there are only 25 keys, one of the lines will reveal a hidden message. The Caesar cipher offers no real security and should never be used to protect sensitive information; modern encryption standards such as AES are designed so that trying every key is impossible in practice. It remains a popular way to introduce the ideas of keys, encryption, decryption and frequency analysis in classrooms and puzzles.
How to use this calculator
- Type or paste the text to encode or decode.
- Choose encode to shift letters forward, or decode to shift them back.
- Enter the shift; use 13 for ROT13.
- Read the result.
- If you do not know the shift, look through the table of all 25 shifts for readable text.
Breaking substitution ciphers
Trying all 25 shifts breaks a Caesar cipher in seconds. More general substitution ciphers, where each letter can map to any other, have far more keys but can be broken with frequency analysis.
In English, E, T and A are the most common letters, so the most frequent symbols in a long ciphertext usually stand for them. This technique was described by the Arab scholar al-Kindi in the ninth century.
From Caesar to modern encryption
The Vigenère cipher improved on Caesar by using a keyword to change the shift for each letter, and resisted casual attack for centuries.
Modern ciphers work on binary data with keys of 128 bits or more, giving more possible keys than could be tried by all the computers on Earth in the age of the universe.
Formula & method
Each letter moves k places along the alphabet, wrapping from Z to AEncode: letter → (position + k) mod 26; decode: (position − k) mod 26ROT13 uses k = 13, so encoding and decoding are the sameDigits, spaces and punctuation are left unchangedEncode: letter at position p becomes (p + k) mod 26. Decode: (p − k) mod 26. ROT13: k = 13, so encoding twice returns the original.
Worked example
Encoding “Hello” with a shift of 3
- H (7) → K (10), e (4) → h (7).
- l (11) → o (14), l → o, o (14) → r (17).
- Result: Khoor; decoding with a shift of 3 restores Hello.
Answer: “Hello” becomes “Khoor” with a Caesar shift of three.
Frequently asked questions
Is the Caesar cipher secure?
No. With only 25 possible shifts it can be broken instantly by trying them all, which is what the table here does; it is used for puzzles and teaching, not for protecting information.
Why is it called a Caesar cipher?
The Roman historian Suetonius wrote that Julius Caesar used a shift of three to protect military messages.
What is ROT13?
A Caesar cipher with a shift of 13; applying it twice gives back the original text.
Are numbers encrypted?
No, this tool shifts letters only and leaves digits, spaces and punctuation unchanged.
Does it keep capital letters?
Yes, uppercase and lowercase letters are shifted separately and keep their case.
What is a shift of 26?
It returns every letter to itself, which is why only shifts 1 to 25 are meaningful.