Caesar Cipher: An Interactive Encoder/Decoder
2026-05-19
The Caesar cipher is one of the simplest and oldest known encryption techniques. Named after Julius Caesar, who reportedly used it to protect military correspondence, the method shifts each letter in the alphabet by a fixed number of positions. A shift of +3 turns A into D, B into E, and wraps Z around to C.
It’s trivially breakable by modern standards — there are only 25 possible shifts to try — but it remains a perfect entry point into the mechanics of substitution ciphers and the logic of cryptanalysis.
The Game
This interactive app lets you practice both sides of the cipher:
Solo Mission — The computer picks a message and a random shift. You’re given the encrypted text, the shift key, and optionally a decryption table. Decrypt it as fast as you can for a score and grade. Three difficulty tiers control message length, shift range, and whether the table is shown by default.
Two Agents — One player writes a secret message and chooses a shift. A handoff screen hides the original before the second player attempts to decode it.
Shareable Puzzles — Every puzzle can be shared as a URL. The message and shift are base64-encoded into the link fragment — nothing hits a server. Send it to a friend and see if they can crack it.
Hints reveal individual letters in the puzzle grid (shown in orange so everyone knows), and a running timer keeps the pressure on.
How the Shift Works
Encryption with a shift of +3:
| Plain | A | B | C | D | E | … | X | Y | Z |
|---|---|---|---|---|---|---|---|---|---|
| Cipher | D | E | F | G | H | … | A | B | C |
Decryption is the reverse — subtract the shift. A cipher letter H with shift +3 maps back to E. The math is modular arithmetic over 26 characters:
E(x) = (x + k) mod 26
D(x) = (x − k) mod 26
where x is the letter’s position (A=0, B=1, …, Z=25) and k is the shift key.
Scoring
Solo mode scores on a point system that rewards speed and penalizes crutches:
| Difficulty | Base Points |
|---|---|
| Recruit | 100 |
| Agent | 250 |
| Commander | 500 |
Deductions: 0.5 points per second elapsed (capped at half the base), 25 points per extra attempt beyond the first, and 40 points per hint used. Grades run from S (80%+ of base) down to D.
Source
Built with React and Tone.js for synthesized sound effects. The entire app runs client-side — no backend, no data collection. Shareable links encode the puzzle into the URL hash using base64.