Skip to main content
Cryptography

The Caesar Cipher: the 2,000-year-old encryption that still slaps

Julius Caesar's shift cipher is the 'hello world' of cryptography. Here's how it works, why it's trivially breakable, and where it still earns its keep today.

Thien Nguyen
By Thien Nguyen
Updated June 28, 2026 · 3 min read

Two thousand years before TLS, Julius Caesar was already worried about people reading his mail. His solution was elegant in its simplicity: shift every letter in the alphabet by a fixed number of places. Shift by three, and A becomes D, B becomes E, and HELLO turns into KHOOR.

That's the whole idea. It is the first cipher most people ever meet, and despite being breakable by a bored teenager with a pen, it teaches nearly every concept that modern cryptography is built on.

How the shift works

Pick a number between 1 and 25 — that's your key. To encrypt, walk each letter forward by the key. To decrypt, walk it back by the same amount. Letters wrap around the end of the alphabet, so with a shift of 3, Z becomes C.

The key insight: encryption and decryption are the same operation run in opposite directions. A shift of +3 to scramble, a shift of −3 to restore.

Non-letters — spaces, punctuation, digits — are usually left untouched, which is exactly why the cipher is so weak: the shape of the message leaks straight through.

Why it's trivially breakable

There are only 25 possible keys. An attacker can simply try all of them and read whichever result looks like language — an attack so cheap it's called brute force, and here the entire keyspace fits on an index card.

Even without brute force, frequency analysis cracks it instantly. In English, E is the most common letter by a wide margin. Find the most common letter in the ciphertext, assume it maps to E, and you've almost certainly recovered the key.

This is the lesson that makes the Caesar cipher worth teaching: a small keyspace is not security. Modern algorithms like AES don't just scramble letters — they use keys with more possible values than there are atoms in the observable universe, precisely so that "try them all" stops being a strategy.

Where a shift cipher still earns its keep

It's not cryptography anymore, but the shift lives on:

  • ROT13, a Caesar cipher with a fixed shift of 13, is still used to hide spoilers and puzzle answers in plain sight — not to protect them, just to stop your eyes from spoiling you by accident.
  • It's a perfect teaching tool for modular arithmetic — the "wrap around the alphabet" behaviour is arithmetic mod 26.
  • It shows up constantly in capture-the-flag puzzles and escape rooms as a first-layer obfuscation.

Try it yourself

The fastest way to build intuition is to watch letters march across the alphabet as you drag the shift. Our Caesar Cipher tool encrypts and decrypts in the browser — nothing is sent to a server — so you can paste a message, sweep the key from 1 to 25, and watch the ciphertext reshape in real time.

Once the shift cipher clicks, the leap to why AES needs a 256-bit key becomes obvious: it's the same idea, scaled until brute force dies of old age.

CryptographyCiphersFundamentals

Related articles

All articles