Classic cipher cracker
Encrypt, decrypt and crack the classic pencil-and-paper ciphers — Caesar, Atbash, affine, Vigenère, Beaufort, autokey, simple substitution, rail fence, columnar transposition and Playfair — with frequency, IoC, chi-squared and Kasiski analysis and a hand-solving workbench.
Added
How to use it
The ciphers in puzzle books, escape rooms, geocache listings and the first chapters of every cryptography book. Paste a ciphertext and each tab tries to break it; paste plaintext and the same tabs encrypt it. None of these are secure — that’s the point of the tool.
How to use it
Paste text in the box at the top, or pick one of the examples (each is a short passage I wrote, encrypted with a different cipher; Reveal the key shows the answer). Under the box are the letter count, the index of coincidence, chi-squared against English and an average quadgram score with a verdict, so you can see at a glance whether a decryption reads as English.
-
Caesar — shift, ROT13 and Atbash, and all 26 shifts ranked, most English first. Use takes a row.
-
Affine —
(a·x + b) mod 26; all 312 keys are tried and the best ten shown. -
Vigenère — also Beaufort and autokey. Find the key splits the text into columns for every key length from 1 to 20 and charts the average index of coincidence of the columns: at the true length each column is a Caesar cipher and looks like English (≈ 0.067). Kasiski counts how many spacings between repeated sequences each length divides. For the best few lengths, each column’s shift is chosen by chi-squared against English letter frequencies, and the keys are ranked by quadgram score. Autokey has no period, so it is decrypt-only.
-
Substitution — encrypt and decrypt with a cipher alphabet (or build one from a key word). Solve hill-climbs: it starts from a frequency guess, swaps pairs of letters and keeps swaps that make the text more English, with random restarts. A couple of hundred letters is usually plenty.
-
Transposition — rail fence (every rail count and starting offset is tried) and columnar transposition by key word or column numbers (Crack tries every column order up to 8 columns, 40,320 orders for 8). By default spaces and punctuation are removed first, as in the classic form.
-
Playfair — the 5×5 key square is drawn as you type the key. Anneal is an experimental simulated-annealing attack; with 150 or more letters it usually recovers the square (or an equivalent rotated one) in a few seconds, running again (up to three times) if a run freezes in a wrong square.
-
Analysis — letter frequencies against English, bigrams, column IoC by period, and a Kasiski table of repeated sequences with their positions and spacings.
-
Workbench — solve a substitution by hand: type the plain letter for each cipher letter and the decryption updates as you go, solved letters in colour. A plain letter used twice is flagged. Start from a frequency guess or a hill-climb and fix the rest yourself.
Long searches run in short slices, so the page stays usable, and can be stopped. Share link carries the text and the settings.
For ROT47, XOR, Base64 and other byte-level encodings use the data recipe tool; for case changes and find-and-replace, the text toolkit.
Where the scores come from
Ranking uses English quadgram (four-letter sequence) statistics. The table,
/tools/ciphers-quadgrams.json, is derived data I counted from six public-domain books from Project
Gutenberg: Pride and Prejudice, The Adventures of Sherlock Holmes, A Tale of Two Cities,
Moby Dick, Frankenstein and Alice’s Adventures in Wonderland — about 3 million letters with
the Gutenberg licence headers removed. It keeps the 12,000 commonest quadgrams (84 % of all
quadgrams in those books) as log probabilities rounded to a tenth, about 48 KB; anything else gets a
floor value. The English letter frequencies are the usual large-corpus figures.
Works in any current browser, including on phones.
Feedback is a gift. Something to improve, a feature to add, or a bug? Tell me.
Runs entirely in your browser; nothing you type leaves this page.