A Beginner's Guide to Classical Ciphers: From Caesar to Vigenère
9 min read · Published July 13, 2026 · Updated July 23, 2026
Contents
Long before computers, people needed ways to keep written messages private — and the solutions they came up with, though laughably weak by modern standards, are genuinely useful for understanding what a cipher actually is and why cryptography evolved the way it did. This guide walks through four classical ciphers — Caesar, ROT13, Atbash, and Vigenère — with real worked examples for each, and an honest explanation of exactly why every one of them is broken today.
What a cipher actually is
A cipher is a rule for systematically transforming a message (the plaintext) into a scrambled version (the ciphertext) using a secret — typically a key, a shift value, or a keyword — that's needed to reverse the process. This is the crucial difference between a cipher and an encoding scheme like Base64: encoding uses a fixed, publicly known rule with no secret involved at all, so anyone can reverse it instantly just by knowing it's Base64. A cipher's entire point is that reversing it requires knowing the secret — without the shift value, the keyword, or the key, the ciphertext should (ideally) be much harder to unscramble.
The four ciphers below all fall into a category called substitution ciphers — each one systematically replaces letters in the plaintext with different letters according to a rule, without changing the letters' order. This makes them intuitive to learn by hand, and also — as you'll see — fundamentally limited in how much real security they can provide.
The Caesar cipher
The Caesar cipher, reportedly used by Julius Caesar for military communications, is the simplest possible substitution cipher: pick a shift number, and replace every letter in the plaintext with the letter that many positions further along the alphabet, wrapping back to "A" after "Z".
Worked example: shifting "HELLO" by 3
With a shift of 3, each letter moves three places forward:
| Plaintext letter | Position | +3, wrapped | Ciphertext letter |
|---|---|---|---|
| H | 7 | 10 | K |
| E | 4 | 7 | H |
| L | 11 | 14 | O |
| L | 11 | 14 | O |
| O | 14 | 17 | R |
So with a shift of 3, "HELLO" becomes "KHOOR". Decrypting just runs the same process backward — shift every ciphertext letter back by 3 — which only works correctly if you know the shift value used to encrypt it in the first place.
Why Caesar ciphers are trivially breakable
The Caesar cipher has exactly one real weakness that makes it useless for anything beyond a puzzle: there are only 25 possible shift values (shifting by 26 just returns the original alphabet, so it doesn't count). That means a Caesar-encrypted message can be broken by brute force in seconds, by hand, simply by trying all 25 possible shifts and reading off which one produces recognizable words. Even without brute-forcing every shift, frequency analysis breaks it just as fast: in English text, "E" is by far the most common letter, so whichever ciphertext letter appears most often is very likely the encrypted form of "E," which immediately reveals the shift value.
ROT13: a special-case Caesar cipher
ROT13 ("rotate by 13") is simply the Caesar cipher with the shift value fixed at exactly 13. It's not used for actual secrecy — it's used to obscure text just enough that it isn't readable at a glance (hiding a spoiler, a puzzle answer, or an off-color joke in a forum post), while still being trivial to reveal on purpose.
ROT13 has one elegant property that comes directly from the number 13: the English alphabet has 26 letters, and 26 ÷ 13 = 2, meaning applying ROT13 twice returns you exactly to the original text. Shifting forward by 13 and then forward by another 13 is the same as shifting by 26 total — a full lap around the alphabet, landing back where you started. This makes ROT13 self-inverse: the same operation both encodes and decodes, with no need to "shift backward" at all.
Working the earlier example through ROT13: H(7)+13=20=U,
E(4)+13=17=R, L(11)+13=24=Y,
L→Y again, O(14)+13=27, which wraps past 25 back to
1=B. So "HELLO" becomes "URYYB" under ROT13. Apply ROT13 to
"URYYB" a second time and each letter shifts forward another 13 places, landing back on
"HELLO" exactly — proving the self-inverse property directly.
The Atbash cipher
Atbash is even older than Caesar's cipher, originally devised for the Hebrew alphabet, and it needs no key or shift value to choose at all — it's a single, fixed mapping that reverses the entire alphabet: A becomes Z, B becomes Y, C becomes X, and so on, meeting in the middle at M/N. The rule for any letter at position i (counting A=0 through Z=25) is: its Atbash-encoded position is 25−i.
Worked example: Atbash-encoding "HELLO"
| Plaintext letter | Position (i) | 25 − i | Ciphertext letter |
|---|---|---|---|
| H | 7 | 18 | S |
| E | 4 | 21 | V |
| L | 11 | 14 | O |
| L | 11 | 14 | O |
| O | 14 | 11 | L |
So "HELLO" becomes "SVOOL" under Atbash. Like ROT13, Atbash is also self-inverse — reversing an already-reversed alphabet returns the original — but unlike ROT13, there's no shift value involved at all, since the mapping (A↔Z, B↔Y...) is completely fixed. That also means Atbash has zero variability to hide behind: anyone who recognizes it's Atbash can decode it immediately with no guessing required whatsoever.
The Vigenère cipher: a genuine historical advance
Unlike the previous three ciphers, the Vigenère cipher (16th century, though popularized and misattributed over the following centuries) represented a real conceptual leap, and it resisted straightforward cryptanalysis for roughly 300 years — long enough to earn the nickname "le chiffre indéchiffrable" ("the indecipherable cipher") in 19th-century France.
Where Caesar, ROT13, and Atbash are all monoalphabetic — the same plaintext letter always becomes the same ciphertext letter throughout the whole message — Vigenère is polyalphabetic: it uses a repeating keyword, and each letter of that keyword determines a different shift amount for the plaintext letter in that position. The practical effect is that the same plaintext letter can encode to different ciphertext letters depending purely on where it falls relative to the keyword, which defeats simple frequency analysis — the ciphertext's letter frequencies no longer cleanly mirror plain English, since each letter isn't shifted by a single consistent amount.
Worked example: encoding "ATTACK" with the keyword "LEMON"
To encode, the keyword is repeated to match the plaintext's length, and each plaintext letter is shifted forward by the numeric value (A=0, B=1, ... Z=25) of the corresponding keyword letter, wrapping around the alphabet exactly like a Caesar shift — the difference is that the shift amount changes letter by letter instead of staying fixed:
| Plaintext | A | T | T | A | C | K |
|---|---|---|---|---|---|---|
| Keyword letter (repeated) | L | E | M | O | N | L |
| Shift amount | +11 | +4 | +12 | +14 | +13 | +11 |
| Ciphertext | L | X | F | O | P | V |
So with the keyword "LEMON," "ATTACK" encodes to "LXFOPV". Notice that plaintext "T" appears twice (positions 2 and 3) and encodes to two completely different ciphertext letters ("X" and "F"), because it lines up with different keyword letters ("E" and "M") each time — this is exactly the property that breaks simple letter-frequency counting, since the ciphertext no longer has one fixed substitute for each plaintext letter.
Vigenère eventually fell too — 19th-century cryptanalysts (notably via a technique called Kasiski examination) found that repeating patterns in the ciphertext reveal the keyword's likely length, and once the length is known, the message can be split into separate groups (one per keyword letter position) that are each just a simple Caesar shift, breakable by the same frequency analysis used against Caesar in the first place.
Are these ciphers safe to use today?
No — none of the four ciphers in this guide provide any real security by modern standards, and none of them were designed with today's computing power in mind. All four can be broken in a fraction of a second by a basic computer program, and Vigenère — the strongest of the four — falls to well-documented, centuries-old cryptanalysis techniques that require no computer at all, just patience and pen and paper. They're genuinely valuable for understanding the history of cryptography, for puzzles, escape rooms, and lightweight text obfuscation (ROT13's actual real-world niche), but not for protecting anything that actually matters.
Modern cryptography solves the same underlying problem — keeping a message unreadable without a secret — using mathematically hard problems and enormous key spaces instead of simple letter substitution. A standard like AES (Advanced Encryption Standard) works over raw binary data with keys of 128 bits or more, meaning the number of possible keys to brute-force is astronomically larger than the mere 25 shift values that make Caesar trivial to crack — a difference of scale so large it isn't really comparable at all. The classical ciphers in this guide and modern algorithms like AES solve the same conceptual problem, but they exist in entirely different eras of what "secure" means in practice.
Frequently asked questions
Which of these four ciphers is the strongest?
Vigenère, by a wide margin — it's the only one of the four that resists simple frequency analysis directly, thanks to its repeating keyword changing the shift amount letter by letter. Caesar, ROT13, and Atbash are all single, fixed substitutions across the whole message, which frequency analysis breaks almost immediately.
Is ROT13 the same thing as encryption?
No — ROT13 offers no real confidentiality at all, since the "key" (a shift of 13) is fixed and publicly known by definition. It's used deliberately as a lightweight, reversible obfuscation for things like spoilers or puzzle answers, not as a security measure.
Can a longer Vigenère keyword make it unbreakable?
A longer keyword does make cryptanalysis harder and requires more ciphertext to crack reliably, but it doesn't make Vigenère unbreakable in principle — the same category of techniques (finding the keyword length, then attacking each position as a simple shift) still applies given enough ciphertext. True unbreakable encryption (the one-time pad) exists, but requires a random key at least as long as the message, used only once — a fundamentally different, much less practical scheme than a short, repeated keyword.
Why learn these ciphers if they're not secure?
Because they're an approachable, hands-on way to understand core cryptographic concepts — substitution, keys, frequency analysis, and the historical arms race between cipher design and cryptanalysis — without needing any background in the number theory that underpins modern cryptography. They're also still genuinely useful for exactly what they were repurposed for: puzzles, games, and light text obfuscation.
Try them yourself
DocNectar's Caesar Cipher Tool, ROT13 Cipher Tool, Atbash Cipher Tool, and Vigenère Cipher Tool all encode and decode text instantly in your browser — a hands-on way to check the worked examples above against your own words, or your own shift values and keywords.
✓ Key takeaways
- ✓ A cipher scrambles a message using a secret key or rule; encoding (like Base64) uses no secret at all
- ✓ The Caesar cipher shifts every letter by a fixed amount — only 25 possible shifts, so it falls to brute force instantly
- ✓ ROT13 is just a Caesar shift of 13, and shifting by 13 twice returns the original text (26 = 2 × 13)
- ✓ The Atbash cipher simply reverses the alphabet (A↔Z, B↔Y...) with no key at all to choose
- ✓ The Vigenère cipher uses a repeating keyword so the same letter encodes differently each time, defeating basic frequency analysis
Tools mentioned in this guide
Sources
Written by the DocNectar Team
Last updated July 2026
More guides
-
SEO Meta Tags Explained
What title tags, meta descriptions, canonical tags, and Open Graph tags actually do, with concrete length guid...
7 min read · SEO Tools
Read →
Updated Jul 23, 2026 -
Invoice Best Practices for Small Businesses
The fields every invoice needs, how payment terms affect your cash flow, and how invoices, quotations, and pur...
8 min read · Business Documents
Read →
Updated Jul 23, 2026 -
PDF Tools Explained: How to Merge, Split, Rotate, and Organize Your Files
What actually happens when you merge, split, rotate, or reorder a PDF, and practical workflows for keeping mul...
7 min read · PDF Tools
Read →
Updated Jul 23, 2026