The Playfair cipher encrypts pairs of letters, not single letters, using a square built from a keyword. It works with the Latin alphabet (a 5 × 5 square) and the Russian one (a 4 × 8 table). For every pair we show the rule and highlight the cells, and you can step through pairs one by one — handy for a lesson.
Everything runs in your browser — the text goes nowhere
the text is split into pairs, each pair goes through the square
Table
Keyword
Filler
Text
Result
13 pairs
BMODZBXDNABEKUDMUIXMMOUVIF
Careful: it may remove a real letter that happens to match the filler.
Square · 5 × 5, I = J
PLAYF
IREXM
BCDGH
KNOQS
TUVWZ
text pairresult
Step by step · pair 1 of 13
pairs with a filler
HI→BMrectangle
The letters are in different rows and columns — take the rectangle's corners: each letter stays in its row and moves to the other's column.
02
How it works
A keyed square
PLAYF IREXM …
The keyword letters without repeats fill the first cells, the rest follow in alphabetical order. In the Latin square I and J share a cell; in the Russian table Ё is written as Е.
Letter pairs
HI DE TH EG …
The text is split into pairs. A filler separates equal letters in a pair and completes an odd last pair.
Three rules
row · column · corners
In one row take the letters to the right, in one column the ones below, otherwise the opposite corners of the rectangle. Decryption goes the other way.
03
Frequently asked questions
Split the text into pairs and find both letters in the square. In the same row, replace each with the letter to its right; in the same column, with the letter below; the count wraps around the edge. Otherwise the letters mark corners of a rectangle, and each moves to the other corner in its own row. With the key “playfair example”, HI becomes BM.
Separate them with a filler: X goes between two equal letters, so TREES splits into TR EX ES. If an odd number of letters remains, the filler is added at the end. If the filler itself repeats, as in XX, a spare letter is used instead — Q for Latin and ъ for Russian here. You can change it in the “Filler” field.
The Russian alphabet has 33 letters, which do not fit a 5 × 5 square. So a 4 × 8 table of 32 letters is used, with ё written as е. The keyword letters come first without repeats, then the rest in alphabetical order. With the key «ключ», the first row is «ключабвг». The pair rules are the same as in the Latin square.
Build the same square from the same keyword and split the ciphertext into pairs. The rules run backwards: in a row take the letter to the left, in a column the one above; the rectangle works the same way. The fillers stay in the result: HIDETHEGOLDINTHETREXESTUMP. “Remove fillers” drops them between equal letters and at the end, but it can also drop a real X, so reread the text.
A 5 × 5 square has 25 cells, and the Latin alphabet has 26 letters, so two must share a cell. J is the usual choice: it is rare and looks like I. That is why JAZZ is encrypted as IAZZ, and decoding gives I where the original had J. Some variants drop Q instead, but the classic description of the cipher merges I and J.
The English physicist Charles Wheatstone, in 1854. It is named after his friend Baron Lyon Playfair, who promoted it to the government. The British Army used Playfair as a field cipher in the Second Boer War and in the First World War: it can be done with a pencil in a few minutes, and frequency analysis of single letters does not work against it.