Works on this device
Classical Cipher Encoder & Decoder
Choose a cipher, type your text and get the encoded or decoded text at once. The tool can also try all Caesar shifts and find the key of a Vigenère cipher. These are ciphers for learning and puzzles, not for real security.
Enter your values
Check these values
Your values are worked out in this browser. They are not sent to a server.
Your result will show here
Fill in the values, then choose Convert.
Your result
How it was worked out
How to use this tool
- Choose a cipher from the list, for example Caesar cipher (shift cipher).
- Type or paste your text.
- Enter the key that the cipher needs: a shift, a key word, or numbers.
- Choose Encode to hide a text, or Decode to read a cipher text.
- Choose Convert. You can copy the result or download it as a text file.
The ciphers and how they work
- Caesar cipher: each letter moves a fixed number of places along the alphabet. With a shift of 3, A becomes D and Z becomes C. The formula is (x + shift) mod 26, with A = 0 and Z = 25.
- Try all 25 shifts: shows the text decoded with every shift, so you can read the one that makes sense. The tool also marks the shift whose letters are closest to normal English.
- ROT13: a Caesar cipher with a shift of 13. Doing it twice gives the first text back.
- Atbash: the alphabet turned around. A swaps with Z, B with Y, and so on.
- Vigenère cipher: a key word gives a different shift for each letter. Key letter A is a shift of 0, B is 1, up to Z, which is 25. The key repeats.
- Find the Vigenère key: for English cipher text. The tool estimates the key length with the index of coincidence, then finds each key letter by comparing letter counts with English.
- Vigenère table: the square of 26 shifted alphabets, also called the tabula recta.
- Affine cipher: (a × x + b) mod 26. The number a must share no factor with 26.
- Rail fence cipher: the text is written in a zigzag over several rails and read rail by rail.
- Keyword substitution: a mixed alphabet that starts with the letters of a key word.
- A1Z26: A is 1, B is 2, up to Z, which is 26.
- Polybius square: each letter becomes its row and column in a 5 by 5 square. I and J share one cell.
- Bacon cipher: each letter becomes five letters made of A and B.
- Caesar box: the text is written into a square and read by columns.
Worked examples
- Caesar, shift 3:
Meet me at the park at noon.becomesPhhw ph dw wkh sdun dw qrrq.M is letter 12, and 12 + 3 = 15, which is P. - Vigenère, key LEMON:
ATTACKATDAWNbecomesLXFOPVEFRNHR. The first letter A (0) with key letter L (11) gives L. The second letter T (19) with key letter E (4) gives 23, which is X. - Atbash:
MeetbecomesNvvg. - Affine, a = 5 and b = 8:
AFFINE CIPHERbecomesIHHWVC SWFRCP. F is 5, and 5 × 5 + 8 = 33, which leaves 7 after dividing by 26. Letter 7 is H. - Rail fence, 3 rails:
WE ARE DISCOVERED. RUN AT ONCE.becomesWECRUOERDSOEERNTNEAIVDACwhen only letters are placed on the rails. - A1Z26:
Hello, World!becomes8-5-12-12-15, 23-15-18-12-4! - Polybius square:
HELLObecomes23 15 31 31 34.
What happens to capitals, spaces and other characters
- Caesar, ROT13, Atbash, Vigenère, affine and keyword substitution change only the 26 letters A to Z. Capital letters stay capital and small letters stay small. Digits, spaces, punctuation, accented letters such as é, and other alphabets are kept as they are.
- In the Vigenère cipher, the key moves on only when a letter is changed.
- The rail fence cipher moves characters and does not change them. You choose if spaces and punctuation are placed on the rails or removed first.
- Polybius and Bacon can encode only letters and spaces. Other characters are removed, and the tool tells you how many. Decoded text is in capital letters.
- A1Z26 keeps all characters that are not letters. Decoded text is in capital letters.
- The Caesar box removes spaces and line breaks, then moves all other characters.
Limits you should know
- These ciphers are easy to break. Do not use them for passwords, private messages or any real secret.
- The likely Caesar shift and the Vigenère key finder compare the text with English letter frequencies. They can give a wrong answer for short texts, for long keys and for other languages.
- The key finder needs at least 20 letters. A few hundred letters work much better.
- The tool does not write program code for a cipher, and it does not break keyword substitution ciphers.
- A text can have up to 20,000 characters. The list of all Caesar shifts takes up to 5,000 characters.