Classical Cipher Workbench
Encode and decode seven classical ciphers in one workbench: Caesar shift, keyword, Polybius square, A1Z26, Nihilist, book cipher and one-time pad arithmetic. Each result comes with the convention it followed written beside it (A counts as 0, I and J share a Polybius cell, / marks a space between words), the alphabet or square it used, and the first 12 steps of the working, so a textbook answer can be checked letter by letter. Caesar takes your own alphabet and, when decoding, tries every shift and ranks them by English letter frequency as an estimate. A book number outside your reference text is refused rather than guessed. The methods are for puzzles and teaching, not for keeping secrets.
encode A = 0 to Z = 25, wrapping after Z; case kept; spaces, digits and punctuation pass through
| plain | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| cipher | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | A | B | C |
- M12 + 3 = 15, P
- e4 + 3 = 7, h
- e4 + 3 = 7, h
- t19 + 3 = 22, w
- b1 + 3 = 4, e
- y24 + 3 = 27, 27 mod 26 = 1, b
- t19 + 3 = 22, w
- h7 + 3 = 10, k
- e4 + 3 = 7, h
- o14 + 3 = 17, r
- l11 + 3 = 14, o
- d3 + 3 = 6, g
and 8 more, worked the same way
decode shift back 3, the same as shifting forward 23
Every letter moves the same number of places along the alphabet and wraps round after the last one. Type your own alphabet to shift digits or symbols as well.
Textbook checks, one per method
Each row is worked by the same code as the stage above. Load puts it in the workbench with its keys.
Common questions
- How does a Caesar shift cipher work?
- Number the letters from A = 0 to Z = 25, add the shift to each one, and wrap round after Z. With a shift of 3, ABCXYZ becomes DEFABC: X is 23, plus 3 is 26, and 26 wraps to 0, which is A. Decoding shifts back by the same amount, which is the same as shifting forward by 26 minus the shift. Letters keep their case, and spaces, digits and punctuation pass through unchanged. The working pane writes out the addition for the first 12 letters, and a negative shift such as -3 is accepted and read as 23.
- Can I use my own alphabet for a Caesar shift?
- Yes. Type the characters in order in the Alphabet field, up to 256 of them, each once and without spaces. The first character counts as 0 and the shift wraps after the last, so with A to Z followed by 0 to 9, a shift of 3 turns X into 0. An alphabet made only of letters of one case, such as a lower-case alphabet or Greek capitals, still shifts both cases and keeps them. Any other alphabet is matched exactly as typed, so characters it does not contain, lower case included, pass through.
- How do I decode a Caesar cipher without knowing the shift?
- Choose Caesar shift and Decode. Below the tool, every possible shift is undone and ranked: the letters A to Z of each result are counted and compared with standard English letter frequencies by a chi-squared score, lowest first. The top five are listed with the start of each result and a Use button, and the full list is one click away. The ranking is an estimate, not a solution, and when the top row has fewer than 40 letters to score the page says so, because one unusual word can reorder the list.
- What is a keyword cipher?
- A substitution where the cipher alphabet starts with the keyword, repeated letters dropped, and continues with the unused letters in order. KRYPTOS gives KRYPTOSABCDEFGHIJLMNQUVWXZ, so KNOWLEDGE IS POWER becomes DGHVETPST BM IHVTL. A full 26-letter alphabet typed as the key is used exactly as given, which makes this a general substitution cipher as well. A key that leaves the alphabet in order, such as ABC, is refused because it would change nothing.
- Why do I and J share a square in the Polybius cipher?
- A 5 x 5 square has 25 cells for 26 letters, so the classical square puts I and J in one cell. JAM encodes as 24 11 32 and decodes as IAM, and the page says so beside the result. Choose the 6 x 6 square to keep J separate and add the digits 0 to 9. Rows and columns can be numbered from 1 or from 0, and an optional square keyword fills the square first. Each letter becomes a two-digit pair, / marks a space between words, and punctuation is dropped and counted.
- What is the A1Z26 cipher?
- Each letter becomes its place in the alphabet, A = 1 to Z = 26, so 1 26 reads AZ. Numbers are separated by spaces with / between words, or joined by dashes with a space between words, as in 8-5-12-12-15 23-15-18-12-4 for HELLO WORLD. A number outside 1 to 26 is an error that names the number, and text written with the other separator is pointed at the right setting.
- How does the Nihilist cipher work?
- It builds a 5 x 5 Polybius square from a keyword, turns each letter into its row and column number from 11 to 55, and adds the number of the next letter of a second key word. With the square ZEBRAS and the key RUSSIAN, D is 23, R is 14, and the first number is 37. The addition is ordinary, not wrapped, so sums can pass 100. Decoding subtracts the key again, and a result that is not a cell of the square is reported with its position.
- How does the book cipher work here?
- Paste a reference text that both sides share. Its words are numbered from 1, with punctuation ignored. In first-letter mode each letter of the message becomes the number of a word starting with that letter, and a repeated letter takes the next such word; in whole-word mode each word becomes the number of the same word in the reference. Decoding looks the numbers up, and a number past the end of the reference is an error, never a guess. The example reference is 40 words long, and every letter A to Z starts at least one of its words.
- Are these ciphers secure?
- No. They are historical and puzzle ciphers, for games, escape rooms and teaching. A Caesar message falls to the ranking on this page, and keyword, Polybius and A1Z26 text gives way to letter counting. The one-time pad mode adds the key letters you type to the message, so HELLO with the key XMCKL gives EQNVZ, and it shows that arithmetic only: this tool does not make keys and makes no claim that a message stays secret.
- Is my text saved or sent anywhere?
- The ciphers run in your browser, and the tool sends nothing you type anywhere. After you change something, the text, the keys and the settings are kept in this browser's local storage so the tool opens as you left it; a reference text too long for the browser to keep is left out. Clear empties the box and removes what the tool saved, and .txt saves the method, the convention, your text, the result and the steps as a file.
Each method follows the convention shown beside it: Caesar shifts count from 0 at the first letter of the alphabet and wrap after the last, the 5 x 5 Polybius and Nihilist squares give I and J one cell, A1Z26 reads 1 26 as AZ, and a book number outside your reference is an error, never a guess. The ranked list of Caesar shifts is an estimate from English letter frequency. These are historical and puzzle ciphers, not modern secure encryption, and the one-time pad mode only shows the arithmetic of the key you type, with no claim that it keeps a message secret.