Playfair Cipher Encoder & Decoder
Encrypt and decrypt with the Playfair digraph cipher. Shows the 5×5 key square, the digraph splitting and which rule was applied to every pair.
Key square
I and J share a cell, so a decrypted I may need to be read as a J from context.
Ciphertext
BMODZ BXDNA BEKUD MUIXM MOUVI F
Digraph working
| Pair | Becomes | Rule applied |
|---|---|---|
| HI | BM | rectangle |
| DE | OD | same column |
| TH | ZB | rectangle |
| EG | XD | rectangle |
| OL | NA | rectangle |
| DI | BE | rectangle |
| NT | KU | rectangle |
| HE | DM | rectangle |
| TR | UI | rectangle |
| EX | XM | same row |
| ES | MO | rectangle |
| TU | UV | same row |
| MP | IF | rectangle |
What is the Playfair Cipher Encoder & Decoder?
The Playfair cipher encrypts letters in pairs using a 5×5 square built from a keyword. Each pair is replaced according to whether the two letters share a row, share a column, or form the corners of a rectangle.
- Encrypt and decrypt with any keyword
- Live 5×5 key square display
- Choice of X, Q or Z as the filler letter
- I/J merge or Q-dropped 25-letter alphabets
- Per-digraph working showing row, column or rectangle rule
- Runs entirely in your browser — nothing is uploaded
How to use the Playfair Cipher Encoder & Decoder
- 1
Choose Encrypt or Decrypt.
- 2
Type a keyword — repeated letters are skipped when the square is built.
- 3
Pick the filler letter and whether J merges into I or Q is dropped.
- 4
Enter your message and read the result update instantly.
- 5
Check the digraph table to see which rule was applied to each pair.
About the Playfair Cipher Encoder & Decoder
The ByteTools Playfair Cipher encodes and decodes messages with the first practical digraph substitution cipher, invented in 1854 and used by the British army into the twentieth century. Enter a keyword, type your message, and watch the 5×5 key square and the pair-by-pair working appear as you type.
Because Playfair encrypts two letters at a time, it hides single-letter frequencies that break simpler ciphers like Caesar and Atbash. The tool handles the fiddly parts for you: merging I and J into one cell, inserting a filler letter between doubled letters, and padding an odd-length message.
Everything runs locally in your browser, so puzzle text and classroom examples never leave your device. Playfair is a teaching and puzzle cipher only — it was solved with pencil and paper in the nineteenth century and offers no real protection today.
Frequently asked questions
How does the Playfair cipher work?
A keyword fills a 5×5 grid, followed by the rest of the alphabet. The message is split into letter pairs, and each pair is replaced using one of three rules depending on whether the letters share a row, share a column, or sit at opposite corners of a rectangle.
Why are I and J combined in a Playfair square?
The alphabet has 26 letters but the grid holds only 25 cells, so one letter must go. Merging I and J is the traditional solution because J is rare in English; when decrypting you read an I as a J wherever the context calls for it.
What happens to double letters like the two Ls in 'hello'?
Playfair cannot encrypt a pair of identical letters, so a filler — traditionally X — is inserted between them. 'Hello' becomes HE LX LO, and the extra X stays in the decrypted text for the reader to spot and remove.
Is the Playfair cipher secure?
Not at all by modern standards. Charles Babbage and others broke it in the nineteenth century, and with a few hundred characters of ciphertext digraph frequency analysis recovers the key square. Use it for puzzles and lessons, never for real secrets.
Why does my decrypted message contain stray X letters?
Those are the fillers added during encryption, either between doubled letters or to pad an odd-length message. The cipher has no way to mark them, so removing them is left to the reader — which is one of Playfair's practical annoyances.
Related tools
Vigenère Cipher Encoder & Decoder
Encode and decode text with the Vigenère polyalphabetic cipher using a keyword, with a live view of how the repeating key aligns to your message.
Caesar Cipher Encoder & Decoder
Encode and decode text with the classic Caesar shift cipher, choose any shift from 1 to 25, and brute-force all 25 shifts to crack unknown messages.
Atbash Cipher Encoder & Decoder
Encode and decode text with the Atbash cipher, an ancient mirror-alphabet substitution where A maps to Z. Self-inverse, preserves case and punctuation.
Rail Fence Cipher Encoder & Decoder
Encode and decode text with the rail fence transposition cipher using 2 to 10 rails, with an optional zigzag visualization of the rail pattern.
ROT13 Encoder & Decoder
Encode and decode text with ROT13 instantly, add ROT5 for digits, or combine both as ROT18. A self-inverse cipher that hides spoilers and puzzle answers.