About Classical Cipher Encoder and Decoder
Pick a cipher, set its key and type: the result updates as you go, in either direction. It covers the ciphers that turn up in puzzles, escape rooms, geocaches and first lessons in cryptography: the Caesar shift, the Vigenère keyword cipher, Atbash, the affine cipher and the rail fence zigzag.
For a Caesar message with an unknown shift, turn on Try every shift. All 25 decodings are listed, ranked by how closely their letters match the usual frequencies of English, so the readable one is normally at the top. These ciphers are for fun and teaching; none of them protects real secrets.
How it works
- Caesar moves each letter a fixed number of places along the alphabet, wrapping from Z to A. Atbash swaps A with Z, B with Y and so on. Affine turns letter number x into (a·x + b) mod 26.
- Vigenère shifts each letter by the matching letter of a repeated keyword (A = 0, B = 1…). The keyword moves on one place per letter of the message, skipping spaces and punctuation, and characters in the keyword other than A to Z are ignored.
- The letter ciphers change only A to Z and keep each letter’s case. Digits, spaces, punctuation and other alphabets pass through unchanged.
- Rail fence writes the text in a zigzag over the chosen number of rails and reads it off rail by rail. It rearranges every character, spaces and punctuation included.
- Try every shift scores each Caesar decoding with a chi-squared test against English letter frequencies and lists the closest first, with a preview of up to 200 characters each.
Questions
Why are only some multipliers offered for the affine cipher?
Decoding needs a multiplier with an inverse modulo 26, which means one sharing no factor with 26. Only the twelve odd numbers other than 13 qualify; any other would send two different letters to the same one and the message could not be read back.
Does Try every shift work for languages other than English?
The ranking uses English letter frequencies, so for other languages the right shift may not come first. All 25 decodings are always listed, so you can still spot the readable one by eye.
Can these ciphers keep a message secret?
No. Every cipher here can be broken in seconds by hand or by computer. Use them for puzzles, games and learning; for real secrets use a modern encryption tool.
How much text can it handle?
Up to 1 MB of text. Try every shift scores the whole text but previews only the start of each decoding.
Everything you enter here is processed in this browser tab. Nothing is uploaded, logged or shared. How privacy works here.