The Playfair cipher is the first practical digraph cipher: letters stop travelling alone and start moving in Digraph pairs over a 5×5 square of letters, so a single plaintext letter no longer determines a single ciphertext letter.
Write the keyword (deduplicated), then the remaining alphabet — without J, which folds into I — under it, and cut it into a 5×5 square.
Split the message into pairs (Digraph). A doubled letter inside a pair gets an X squeezed between the twins; an odd tail gets an X at the end.
For each pair, find both letters in the square and apply the first rule that fits:
same row → each letter takes its right-hand neighbour (wrapping around);
same column → each letter takes the one below it;
otherwise → each letter takes the corner of the rectangle that lies in its own row and its partner's column.
Write the result in pairs.
The square built from the keyword PLAYFAIREXAMPLE starts
PLAYF / AIREX / AMPLE …. HI has no shared row or column, so
each letter jumps to the opposite corner of the rectangle —
CX. EG shares a column, so both letters step down —
LQ. Notice the deep change from older ciphers: the same letter
encrypts differently depending on its partner.
There is no formula in the affine sense — the key is a whole table. Mathematically it is a substitution on 336 possible digraph pairs (25 letters, minus the impossible doubles), driven by row, column and rectangle rules that all shift pairs inside the square while never mixing rows and columns.
Decryption runs each rule backwards: left instead of right, above instead of below, corners stay corners. Two artefacts travel with the system: an I in the plaintext always appears where a J was written, and every X is ambiguous — it may be a genuine X or a filler. Both were accepted costs in the field: telegraph clerks could learn the square in an afternoon and never touch a table of 26 frequencies.
Try it in the toolType your message into the message input.
Enter a keyword in the Key field — short and memorable, like SHADOW. The keyword deduplicates and seeds the square.
Read the encrypted pairs in the output field — the tool joins them with spaces, and those spaces are decorative: decrypting ignores them.
Paste the cryptogram into the message input — with or without the spaces between pairs, both work — and press the swap button the swap button.
Enter exactly the keyword the sender used in the Key field. The square is the whole key: a wrong keyword produces a different square and pure noise.
Read the plaintext in the output field. Watch for the two artefacts: an I may stand where a J was written, and an X may be a filler rather than a letter.
Count the letters. Playfair needs volume — its digraph statistics only wake up over a few hundred letters.
If the key is known or guessable (a name, a unit, a codeword), simply build the square and decrypt — see the guides above.
If not, this is textbook digraph frequency analysis: TH, HE, AN, RE, ER and ON dominate English pairs, and each guessed digraph placement in the square constrains many others. That attack is powerful but patient — the practice tab's challenges all hand you the keyword instead.
Playfair was the last classical cipher to hold real field value — and the first to fall to statistics in a new way: not letter frequencies but pair frequencies. This page shows why the digraph idea delayed the old attacks, and what replaces them.
Try it in the toolSingle-letter frequency dies here: an E may encrypt to a dozen different letters depending on its partner. But digraphs have habits of their own — TH, HE, AN, RE and ER tower over the rest of English pairs — and the cipher's own structure amplifies the leak: many plaintext pairs map to ciphertext pairs that share a letter, and the rectangle rule links pairs that differ in only one letter.
Gather a few hundred pairs of Ciphertext.
Build a digraph frequency table and match the giants (TH, HE, AN, RE, ON…) against the most common ciphertext pairs.
Each confirmed mapping pins letters into the square; each pinned letter constrains the rows and columns of several others. The square reconstructs itself like a crossword grid.
With enough text the square falls whole; with too little, the mixed-up guesses multiply — this is why short field messages survived.
The square is only as secret as its keyword, and field keywords are chosen by humans: unit names, place names, the week's codeword. Given a Crib or a guess, build the candidate square and decrypt a line — sense confirms the key instantly. The practice challenges work exactly this way.
A digraph-frequency cracker needs a corpus-level solver, not a key-search loop: the search space of squares (25!) dwarfs any Caesar-style sweep, but the constraint propagation is the interesting part. The tool therefore leaves Playfair cracking as an exercise — the demo above shows the mechanics of a known crib, and the guides above show where the statistics would attach.
Playfair held the field from 1854 until radio made volume fatal: large wireless traffic fed the digraph tables, and by the end of WWI the cipher was transparent to serious opponents. Its legacy is the digraph itself — the idea that grouping letters before substituting multiplies the work of the analyst. Every later two-square, four-square and even rotor design inherits it.