Playfair Cipher: Encode, Decode & Examples
Learn the Playfair cipher: build the 5x5 key square, apply the three pair rules, then encode and decode a full worked example by hand.
Encode or decode text with the Playfair cipher and your own keyword. Free, private — nothing leaves your device.
Your Playfair result will appear here.Type any keyword and the 5x5 key square is built for you, with repeated letters removed and I and J sharing a cell.
The result updates as you type. No button to press.
Repeated letters in a pair and an odd last letter get an X filler (a Q when the letter is itself X), the standard Playfair rule.
Runs entirely in your browser. Nothing you type is uploaded or stored.
Type the keyword you and the other person agreed on. It sets up the 5x5 letter square the whole cipher depends on.
Pick the direction and type or paste your message. Playfair works on pairs of letters, so the result appears in pairs.
The text updates live as you type. Copy it, download it as a .txt file, or use swap to feed the result back in and check your work.
Playfair was a real field cipher in the early 1900s. Today it's best for teaching, puzzles, and checking hand-worked answers, not for real security.
Check a hand-worked Playfair answer instead of redoing the square by hand.
Playfair clues show up in puzzle hunts. Paste the ciphertext, type the keyword, and read the answer.
Decode a known-keyword Playfair clue quickly and move on to the harder part.
Try the digraph cipher used by British forces in the Boer War and World War I.
Playfair is a substitution cipher that encrypts pairs of letters (digraphs) instead of single letters. A keyword fills a 5x5 grid, and each pair is swapped according to where its two letters sit in that grid. It was invented by Charles Wheatstone in 1854 and promoted by Lord Playfair.
Enter the keyword, switch to Decode, and paste the ciphertext. By hand you rebuild the 5x5 square from the keyword, then for each pair move left if the letters share a row, up if they share a column, or swap to the other corners of the rectangle. The tool does that for every pair at once.
The 5x5 grid only has room for 25 letters, so J is treated as I. Spaces, digits and punctuation can't be carried by the cipher and are dropped from the output.
When a pair would be two identical letters, or the message has an odd number of letters, the encoder adds an X filler. Decoding gives those X letters back, so you read past them, for example BALLOON is encoded as BA LX LO ON, and decoding gives BALXLOON back.
No. It's harder to break than a simple substitution because it works on pairs, but modern frequency analysis and computers crack it easily. Use it for puzzles and learning, never for real secrets.
Not with this tool, which needs the keyword. Without it, solving Playfair means guessing words or using hill-climbing software. If you know a likely word in the message you can often work backwards to the square.
No. Everything runs in your browser, and nothing you type is sent to a server.
Free, no account needed.