Classical Cipher Identification & Breaking Guide
How to identify Caesar, Vigenère, Atbash, and Rail Fence ciphers from ciphertext alone, and break them with frequency analysis and index of coincidence.
Classical ciphers are substitution or transposition schemes that operate on letters rather than bits. They were the state of the art in cryptography from ancient Rome through World War II. Today they appear almost exclusively in CTF challenges and cryptography education — but understanding how to break them builds intuition for modern cryptanalysis.
The key insight in classical cryptanalysis is that natural language has predictable statistical properties. In English, 'e' appears ~12.7% of the time, 'th' is the most common digraph, and words like 'the', 'and', 'of' dominate. Any cipher that preserves these statistics can be broken by frequency analysis.
How to identify the cipher type
Before you can break a cipher, you need to identify which one you're dealing with. Start by examining the ciphertext's character set and structure.
If the ciphertext contains only letters (A-Z), it's likely a classical substitution or transposition cipher. If it contains numbers, it might be a Polybius square or Playfair. If it contains only 0s and 1s, check for Bacon's cipher (5-bit encoding of letters).
Compute the Index of Coincidence (IC). For English plaintext, IC ≈ 0.065. For a Caesar cipher (monoalphabetic substitution), IC ≈ 0.065 (same as English — letter frequencies are preserved, just shifted). For a Vigenère cipher with a short key, IC is lower (0.04–0.06). For random text, IC ≈ 0.038.
Cipher-by-cipher breakdown
IC ≈ 0.065. Letter frequency distribution matches English but is shifted. The most common letter in the ciphertext corresponds to 'e' in the plaintext.
Try all 25 possible shifts (brute force). For each shift, check if the result looks like English. Alternatively, find the most frequent letter in the ciphertext — if it's 'X', the shift is X - E = 19 (mod 26).
KHOOR ZRUOG → shift 3 → HELLO WORLDIC between 0.04 and 0.06. No single letter dominates the frequency distribution. The Kasiski test finds repeated sequences in the ciphertext — their distances share a common factor equal to the key length.
1) Find the key length using the Kasiski test or IC analysis. 2) Split the ciphertext into groups by key position (every nth letter). 3) Each group is a Caesar cipher — solve each independently using frequency analysis.
Key: KEY. Plaintext: ATTACK. Each letter is shifted by K(10), E(4), Y(24), K(10), E(4), Y(24) → KXEEKCIC ≈ 0.065. A=Z, B=Y, C=X mapping. The most common letter in ciphertext maps to 'v' (since e=22nd letter, atbash(e)=v).
Atbash is its own inverse — apply the same transformation to decrypt. A→Z, B→Y, C→X, ..., Z→A.
SVOOL DLIOW → HELLO WORLDIC ≈ 0.065 (transposition preserves letter frequencies). The ciphertext length divided by the number of rails gives the approximate rail length. Try 2, 3, and 4 rails first.
Write the ciphertext in a zigzag pattern across N rails. Read off each rail in sequence. Try different rail counts until the plaintext is readable.
3 rails: H.L.O / E.L.W.R.D / .L. .O. → HLOELWRDLO → HELLOWORLDA special case of Caesar with shift 13. Common in CTFs and online forums for spoiler text. IC ≈ 0.065.
Apply ROT13 again (it's its own inverse). A→N, B→O, ..., N→A, ..., Z→M.
URYYB JBEYQ → HELLO WORLDEnglish letter frequency reference
Memorize the top 6: E, T, A, O, I, N. They account for ~50% of all letters in typical English text. The most common letter in your ciphertext is almost certainly 'e' in the plaintext (for monoalphabetic ciphers).
Break ciphers in the Cipher module
The Cipher module includes a Caesar solver with all 25 shifts, a Vigenère analyzer with automatic key-length detection, frequency analysis charts, and a cipher identifier — all running in your browser.
Open Cipher Module