What is a Caesar cipher alphabet?
A Caesar cipher replaces every letter with the one a fixed number of places further along the alphabet. Write the normal alphabet on one line and the moved alphabet underneath, and you have the key to a whole message. The top line is the plain alphabet. The line below is the cipher alphabet.
The English alphabet has 26 letters, which gives 25 useful shifts, because a shift of 0 or 26 leaves every letter where it was. The table above lists all 25, so you never have to count along the alphabet on your fingers.
How to use the table
To encrypt, go to the row for your shift. Find each letter of your message in the top row and write down the letter directly below it. Here is ATTACK AT DAWN with a shift of 3:
ATTACK AT DAWN
DWWDFN DW GDZQ Letters near the end wrap round to the start, so with a shift of 3, X becomes A, Y becomes B and Z becomes C. Spaces and punctuation stay as they are.
To decrypt, work the other way round. Find each coded letter in the row for the shift and read the plain letter at the top of its column. If you don't know the shift, try the rows one at a time until words appear, or let the Caesar cipher solver try them all at once.
The alphabet Julius Caesar used
According to the Roman writer Suetonius, Julius Caesar wrote his private letters by putting each letter three places further on, so A was written as D. That is row 3 of the table:
ABCDEFGHIJKLMNOPQRSTUVWXYZ
DEFGHIJKLMNOPQRSTUVWXYZABC Caesar wrote in Latin, and the Latin alphabet of his day had fewer letters than ours, so his version wrapped round at a different point. The history of the Caesar cipher covers what the sources say about how he and Augustus used it.
The formula behind the table
Every row comes from the same sum. Number the letters from A = 0 to Z = 25, add the shift, then keep the remainder after dividing by 26. That remainder is the number of the cipher letter. Mathematicians write it with mod, short for modulo:
E(x) = (x + n) mod 26
D(x) = (x - n) mod 26 Take Y with a shift of 3. Y is 24, and 24 + 3 = 27. Dividing 27 by 26 leaves 1, which is B. Decoding uses subtraction: B is 1, 1 - 3 = -2, and -2 mod 26 is 24, so you get Y back.
The formula also gives you a shortcut. Decoding with shift n gives the same result as encoding with shift 26 - n, so a message encrypted with shift 3 comes back as plain text in row 23.
Alphabets with more letters
This table uses the 26 letters of English. Languages with extra letters need a longer alphabet, which also means more shifts: Spanish with Ñ has 27 letters, and the Polish alphabet in the tools on this site has 35. Every letter that comes after an extra one sits a place further along, so the same shift gives a different result:
| Alphabet | Plain text | Cipher text (shift 3) |
|---|---|---|
| English, 26 letters | MAÑANA | PDÑDQD |
| Spanish, 27 letters | MAÑANA | ODQDPD |
In the 26-letter version the Ñ is not part of the alphabet, so it passes through unchanged. You can switch to Polish, German, Spanish or French letters in the Caesar cipher tool and on the cipher wheel.
A printable Caesar cipher table
The print button above the table prints the table by itself, without the menu and ads around it. In class, each pupil can encode a short word with one row, swap papers with a neighbour and work out which shift the other person used. For something to hold and turn, print and cut out the Caesar cipher wheel instead.
Frequently asked questions
How many Caesar cipher alphabets are there?
With the 26 letters of English there are 25, one for each shift from 1 to 25. A shift of 26 brings back the plain alphabet. Longer alphabets give more: 26 shifts for Spanish with Ñ, and 34 for the 35-letter Polish alphabet.
Which row of the table is ROT13?
Row 13. Thirteen is half of 26, so applying the same row twice brings you back to the start. That is why ROT13 uses one step for both encoding and decoding.
How do I decode a Caesar cipher without the shift?
Try the rows. Decode the first word with shift 1, then 2, and keep going until a real word appears. This is called a brute force attack, and with only 25 rows it takes a few minutes by hand.
Can the Caesar cipher protect real secrets?
No. Anyone can try all 25 rows, so the cipher is fine for puzzles, games and learning how encryption works, but it should never protect passwords or personal data.