What it is
Playfair encrypts two letters at a time using a 5 × 5 square built from a keyword (I and J share a cell). Because it works on pairs, the same letter turns into different letters depending on its partner, which defeats simple letter counting. Charles Wheatstone invented it in 1854 and his friend Lord Playfair promoted it; the Foreign Office first thought it too complicated, but it was later used in the field. Read the Archive card Too Hard for Diplomats.
Build the square
The keyword's letters go in first (no repeats, J as I), then the rest of the alphabet. Type a keyword to build one.
How to encode
- Drop spaces and punctuation, write J as I, and split the message into pairs.
- If a pair is a doubled letter, put an X between them (a Q if the letter is X). If one letter is left over at the end, add an X.
- For each pair: same row, take the letter to the right of each; same column, the letter below each; otherwise they form a rectangle, and each takes the other corner in its own row.
How to break it, step by step
- Spot it. An even number of letters, no J, no word breaks, and no pair made of one letter twice: that smells like Playfair.
- With the keyword, build the square and reverse the rules: same row, go left; same column, go up; rectangle, take the other corner in your row.
- Remove the fillers. An X between two equal letters, or a final X, was added; drop it.
- Without the keyword it's hard by hand: count which pairs repeat and guess common pairs such as TH and HE. That's how wartime codebreakers did it, with a lot of paper.
Worked example 1: decoding with the keyword
Keyword GARDEN:
| G | A | R | D | E |
| N | B | C | F | H |
| I/J | K | L | M | O |
| P | Q | S | T | U |
| V | W | X | Y | Z |
OD DU OD FW UF HU BQ
| Pair | Rule | Reversed |
|---|---|---|
OD | rectangle | ME |
DU | rectangle | ET |
OD | rectangle | ME |
FW | rectangle | BY |
UF | rectangle | TH |
HU | same column | EO |
BQ | same column | AK |
Put together: MEETMEBYTHEOAK. This one needed no fillers at all: the two Es of MEET fall into different pairs (ME, ET), so they never meet in one pair. Answer: MEET ME BY THE OAK.
Worked example 2: doubles and padding
Encoding BALLOON RACE with keyword TULIP: the pairs come out as BA LX LO ON RA CE. That's a filler between the doubled L. The doubled O didn't need one: its two Os landed in different pairs.
Encrypted: CB CL UQ QO ND DA. Decoding it gives BALXLOONRACE; drop the fillers to read BALLOONRACE (BALLOON RACE).
Common mistakes
- Using the encoding directions to decode. Decoding goes left and up, not right and down.
- Forgetting to merge J with I when building the square.
- Dropping an X that's really part of a word, like the X in EXIT. Only drop an X between two equal letters or at the very end.