The keyed square§
Playfair writes a keyword without duplicates into a 5×5 square, then fills the remaining cells with the unused alphabet. In the traditional English form I and J share a cell. Plaintext is normalised into pairs; repeated letters in one pair are separated with a filler such as X.
Three rules for every pair§
If both letters are on the same row, encrypt each with the letter to its right. If they are in the same column, use the letter below. Otherwise they form the corners of a rectangle: keep each letter's row and take the other letter's column. Decryption reverses the row and column steps; the rectangle rule is its own inverse.
What to look for§
Traditional Playfair ciphertext has an even number of letters, contains no J, and cannot have a doubled letter within a ciphertext pair. These are useful hints, not guarantees. A carefully prepared substitution message can share some of them, and variants may use a different alphabet or filler.
Why automated attacks are hard§
The unknown key is a 25-cell permutation, not a short word. One wrong cell disrupts many pairs, creating a fitness landscape full of narrow local optima. Effective attacks combine broad exploration, such as simulated annealing, with population-based or hill-climbing refinement, scoring candidate plaintexts using tetragrams. Hundreds of letters help; thousands are better. If a puzzle supplies a likely keyword, test it first.
Return to the cipher wiki field guide for the other common classical families.
Frequently asked questions§
Why are I and J combined in Playfair?
A 5 by 5 square holds 25 cells, but the Latin alphabet has 26 letters. Traditional English Playfair merges I and J into one cell. Other alphabets and six-by-six variants make different choices.
Why does Playfair insert X characters?
A digraph cannot contain the same letter twice. A repeated letter is split with a filler, traditionally X, and an odd-length message gets a final filler. That means decryption returns the intended letters plus ambiguous Xs that a reader removes from context.
Can frequency analysis break Playfair?
Single-letter frequency analysis is much less direct because Playfair encrypts pairs. Modern classical-cipher attacks score candidate decryptions by n-grams and use simulated annealing or genetic search to rearrange the grid. Long ciphertext is important.