classical · level 1

Caesar Cipher

Shift every letter by a fixed amount.

100 XP

Caesar Cipher

Julius Caesar reportedly used a simple trick to protect military dispatches: shift every letter of the alphabet forward by three positions. A becomes D, B becomes E, Z wraps around to C. Anyone intercepting the message without the key would see gibberish — unless they knew to shift back by three.

Analogy

Remember the cereal-box decoder rings kids used to send secret notes at summer camp? Two paper discs pinned together — outer disc has the real alphabet, inner disc the "secret" alphabet, and you rotate the inner one by some agreed number of clicks. To read a note, you line up the rings the same way and read off the replacement letters. That is literally the Caesar cipher, which is why any classmate who found the note could just try all 26 rotations and break it in about a minute.

The shift operation

Encryption with shift k:

E(x) = (x + k) mod 26

Decryption:

D(x) = (x − k + 26) mod 26

Adding 26 before taking the modulo prevents negative remainders in languages where % can return negative values.

Plaintext Position + 3 (mod 26) Ciphertext
A 0 3 D
X 23 0 A
Z 25 2 C

Why it is trivially broken

There are only 26 possible shifts. A brute-force attack simply tries all of them. A human reads the 26 candidates and identifies the one that looks like English. No computer required.

Statistical attack — frequency analysis. Even without trying every key, you can decrypt by counting letters. In English, E accounts for roughly 12.7% of letters, T for 9.1%, A for 8.2%. In a Caesar ciphertext, whichever letter appears most often is probably the encryption of E. The shift is the difference between that letter's position and E's position (4). One ciphertext, one frequency count, one subtraction, done.

The key-space problem

Security requires a large key space. Caesar's key space is 26. With 26 equally likely keys, a brute-force attack requires at most 25 guesses. Modern symmetric ciphers use 128- or 256-bit key spaces — 2¹²⁸ is roughly 3.4 × 10³⁸ — making exhaustive search computationally impossible.

Playground

Use the shift slider to encrypt and decrypt text. Hit Brute Force to see all 26 shifts ranked by how much they look like English — the frequency scorer computes the cosine similarity of each candidate's letter distribution against the expected English distribution.

Visualizer

The Caesar wheel shows the two alphabet rings aligned. The outer ring is plaintext; the inner ring is ciphertext. Rotating the inner ring by the shift shows exactly which letter maps to which.


Example intercept

For practice: the field archive preserved this intercepted transmission under the tag apprentice-signal. The ring on duty that shift recorded its rotation as "the most classic of all."

QRPVZN{ebgngr_gb_erirny}

The cleartext is the apprentice's badge.