Playfair Cipher Step by Step
Encrypt/decrypt with Playfair showing the 5×5 matrix, letter pairs and the rule applied to each digram.
—
Playfair: the first digram cipher actually put to use
Invented by Charles Wheatstone in 1854 and promoted by Lord Playfair, this was the first digram cipher genuinely used in the field — the British employed it in the Boer War and the First World War. Its advantage at the time was practical: encipher in your head, with paper and pencil, no equipment at all, and still escape simple frequency analysis.
Enter the key and the text and the page shows the five-by-five grid assembled and the route of each pair. The three rules: letters sharing a row are replaced by their right-hand neighbours; sharing a column, by the ones below; and in different rows and columns, each swaps to the other's column, forming a rectangle. In every case the movement wraps around when it reaches the edge of the grid.
Preparing the text has rules of its own that often confuse: repeated letters within a pair are separated by an X, because the rectangle rule breaks down when both are the same, and a trailing X closes the pair when the length is odd. That is why deciphering turns up X letters in the middle of words — they are usually padding, and reading discards them.
Frequently asked questions
Why are identical letters in a pair a problem?
How was Playfair broken?
Which letter is left out of the grid?
Related Tools
Custom Polybius Square
Build a 5×5 Polybius square with a key letter and encrypt/decrypt messages using numeric coordinates.
Hill Cipher 2×2
Encrypt text with a 2×2 matrix mod 26 (Hill cipher) — algebraic explanation and key invertibility check.
Pigpen (Masonic) Cipher
Encipher text in Pigpen (the Masonic cipher), drawing all 26 symbols, with the full reference alphabet below.
Keyword Cipher
Build the cipher alphabet from the keyword you choose, followed by the remaining letters. Enciphers and deciphers, and shows the generated alphabet next to the plain one.
Monoalphabetic Substitution Cipher
Encrypt/decrypt with a custom A-Z substitution key and show letter frequencies for didactic analysis.
Polybius Square Cipher
Encrypt and decrypt messages with the Polybius square, which turns each letter into a pair of digits on a 5×5 grid (with I and J combined).