Ciphers & codes

Caesar cipher – explained simply

The Caesar cipher is the best-known secret code in the world – and the simplest: every letter moves a few places down the alphabet. Here is how it works, how to do it by hand and why anyone can crack it in seconds.

Free online tool: type your text, choose a shift – the result appears instantly, with alphabet table. No sign-up.

Open the Caesar tool

How the Caesar cipher works

Every letter is shifted a fixed number of places down the alphabet. That number is the key. With the classic shift of 3, A becomes D, B becomes E – and at the end of the alphabet you wrap around to the start: X becomes A, Y becomes B, Z becomes C.

PlainABCDEFGHIJKLMNOPQRSTUVWXYZ
CipherDEFGHIJKLMNOPQRSTUVWXYZABC

Spaces, digits and punctuation usually stay as they are. Accented letters are written without accents first (é → e), because the cipher alphabet only knows A to Z.

Example: VENI VIDI VICI

With key 3, Caesar’s famous line becomes:

Plaintext:  VENI VIDI VICI
Ciphertext: YHQL YLGL YLFL

To decrypt, simply shift the other way, 3 places back. “Phhw ph dw wkh irxqwdlq” turns back into “Meet me at the fountain”.

As a formula: number the letters from A = 0 to Z = 25, then cipher = (plain + k) mod 26 and plain = (cipher − k) mod 26.

Type your text, pick a shift, done – or let the tool crack a ciphertext for you.

ROT13 and other shifts

There are only 25 useful keys in total – a shift of 0 or 26 changes nothing.

Cracking Caesar: two ways

1. Try all 25 keys

Because there are so few keys, you simply try them all and see which result is readable (“brute force”). By hand it takes a few minutes; a computer needs milliseconds.

2. Frequency analysis

In English, E is the most common letter at about 12.7 %, followed by T, A, O and I. If H is the most frequent letter in the ciphertext, a shift of 3 is likely (E → H). With longer texts this works almost every time.

In the tool, paste a ciphertext and choose “Crack”: it tries every shift, ranks the results with an English and a German language model and shows the frequency chart alongside.

Caesar in class and treasure hunts

The Caesar cipher is the classic introduction to cryptography in computer science and maths lessons: you instantly grasp the idea of key and method – and see why a tiny key space is insecure. For kids, a Caesar wheel works well: two paper discs with the alphabet, the inner one rotating.

For a treasure hunt, the tool prints a puzzle sheet with the ciphertext and, if you like, the alphabet table as a hint.

Not for real secrets: Caesar protects nothing. For confidential messages, pick “AES-256 with password” in the tool.

Encode and decode Caesar online

With a slider for the shift, alphabet table, one-click cracking and a printable puzzle sheet. Runs only in your browser.

FAQ

How does the Caesar cipher work?

Every letter is shifted a fixed number of places in the alphabet; with key 3, A becomes D, B becomes E and Z becomes C. To decrypt, shift back.

Which key did Caesar use?

According to Suetonius, Julius Caesar shifted by 3. Augustus is said to have shifted by 1.

How many keys are there?

25 – shifts from 1 to 25. That is why any Caesar text can be cracked by trying them all.

What is ROT13?

A Caesar shift by 13. Since 13 is half of 26, applying ROT13 twice gives the plaintext again.

How do I decode a Caesar cipher without the key?

Try all 25 shifts and pick the readable one, or match the most frequent ciphertext letter to E. The tool’s “Crack” button does both automatically.

Is the Caesar cipher secure?

No. It can be cracked in seconds and is only good for puzzles, lessons and games.

Sources

  1. Caesar cipher – Wikipedia.
  2. Suetonius, De vita Caesarum, Divus Iulius 56 and Divus Augustus 88 – the source for Caesar’s and Augustus’ shifts.
  3. Letter frequency in English – Wikipedia.

Caesar cipher online – free, no sign-up.

Open the tool