Playfair Cipher — Encrypt & Decrypt with Key Square
Encrypt and decrypt the Playfair cipher from a keyword: see the 5×5 key square, each digraph and the rule used. I/J merged or Q omitted, custom filler letter.
1 filler letter was added to split double letters or pad the end.
| 1 | 2 | 3 | 4 | 5 | |
|---|---|---|---|---|---|
| 1 | P | L | A | Y | F |
| 2 | I | R | E | X | M |
| 3 | B | C | D | G | H |
| 4 | K | N | O | Q | S |
| 5 | T | U | V | W | Z |
| Plaintext pair | Rule | Result |
|---|---|---|
| HI | rectangle: swap columns | BM |
| DE | same column: letter below | OD |
| TH | rectangle: swap columns | ZB |
| EG | rectangle: swap columns | XD |
| OL | rectangle: swap columns | NA |
| DI | rectangle: swap columns | BE |
| NT | rectangle: swap columns | KU |
| HE | rectangle: swap columns | DM |
| TR | rectangle: swap columns | UI |
| EX | same row: letter to the right | XM |
| ES | rectangle: swap columns | MO |
| TU | same row: letter to the right | UV |
| MP | rectangle: swap columns | IF |
The Playfair cipher, invented by Charles Wheatstone in 1854 and promoted by Lord Playfair, encrypts pairs of letters instead of single letters, which hides the letter frequencies that break simple substitution ciphers. It was used in the field by British forces into the early 20th century. This tool builds the 5×5 key square from your keyword, encrypts or decrypts, and shows every digraph with the rule that was applied.
How to use this tool
- Choose encrypt or decrypt and paste the text.
- Type the keyword; repeated letters are used once.
- Pick the square type (I/J together is the usual one) and the filler letter.
- Read the result and the digraph table; when decrypting, check the "without fillers" guess.
Formula
Same row → each letter is replaced by the one to its right. Same column → the one below. Otherwise → the letter in the same row but in the other letter’s column.
Before encrypting, the text is split into pairs; a double letter such as EE is split with the filler (E X E…), and an odd final letter is padded. Decryption moves left and up instead. Rows and columns wrap around. The key square is the keyword without repeats, followed by the rest of the alphabet.
Example
With the keyword PLAYFAIR EXAMPLE the square is PLAYF / IREXM / BCDGH / KNOQS / TUVWZ. "Hide the gold in the tree stump" becomes the pairs HI DE TH EG OL DI NT HE TR EX ES TU MP (the double E of "tree" is split with X) and encrypts to BMODZBXDNABEKUDMUIXMMOUVIF.
Frequently asked questions
Why does the decrypted text contain extra X letters?
They are fillers added when encrypting, to split double letters and to make the length even. The "without fillers" line removes an X between two equal letters and at the end, but a genuine X in the message may also be removed, so read it in context.
What happens to J?
The 5×5 square holds only 25 letters, so I and J share a cell and J is written as I. Some variants drop Q instead; pick that option if your puzzle uses it.
Is Playfair secure?
No. It resists simple frequency counting, but digraph frequencies and known plaintext break it quickly, and computer hill-climbing solves it in seconds. Use it for puzzles and history, not secrets.
Last updated:
Page address with these inputs: https://kakao.mobile/tools/playfair-cipher-tool/
Cite or embed this tool
kakaoCalc. (2026, November 8). Playfair Cipher — Encrypt & Decrypt with Key Square. https://kakao.mobile/tools/playfair-cipher-tool/
“Playfair Cipher — Encrypt & Decrypt with Key Square.” kakaoCalc, 8 Nov. 2026, kakao.mobile/tools/playfair-cipher-tool/.
Paste this code into your page. The widget runs in your visitors' browsers, shows no ads and keeps a link back to this page. Embedding terms