Cipher
Runs in your browser. Your text never leaves your device.
Playfair Cipher Encoder and Decoder
The Playfair cipher encrypts pairs of letters instead of single letters, using a 5x5 grid built from a keyword. Enter a keyword to build the grid, type your message, and read the encrypted letter pairs live. Set the same keyword to decrypt.
BS SB IC BS GE XM
Links carry your text after the # sign. Browsers never send that part of an address to a server, so it only reaches the people you share the link with.
Recent
Nothing yet. Your last 10 conversions, across every cipher, appear here. They are kept on this device only.
Playfair Cipher at a glance
- Type
- Broken cipher (keyed)
- Key space
- 25! grid arrangements, far fewer in practice from real keywords
- Directions
- Encode and decode: Plain text to Cipher pairs and back
- Example
HELLO→DB NV MI(keyword KEY, the tool's default)- Privacy
- Runs in your browser, nothing is uploaded
It was the first cipher to encrypt digraphs rather than individual letters, which defeats the simple frequency counting that breaks Caesar or Atbash. Everything runs in your browser; your keyword and message never leave your device.
How the Playfair Cipher works
The keyword fills a 5x5 grid first, skipping repeated letters, and the rest of the alphabet follows in order (I and J share a cell, since 26 letters cannot fit 25). The message is split into pairs of letters; a doubled letter or a leftover single letter at the end gets a filler X.
Each pair is looked up in the grid. If both letters share a row, each is replaced by the letter to its right. If they share a column, each is replaced by the letter below. Otherwise, each letter is replaced by the one in its own row but at the other letter's column, tracing a rectangle.
Examples
History and origins
Charles Wheatstone invented the cipher in 1854, but it is named after his friend Lord Playfair, who championed it to the British government. The British Army used it as a field cipher from the Second Boer War through both World Wars, valued for being fast enough to use by hand yet far stronger than a simple substitution.
Its strength comes from encrypting 26 by 26, or 676, possible letter pairs instead of 26 single letters, which hides the letter-frequency patterns that make Caesar or Vigenere easier to crack. It eventually fell to digraph frequency analysis once cryptanalysts had enough intercepted traffic to study.
Frequently asked questions
Why is the Playfair cipher stronger than a simple substitution?
It encrypts pairs of letters instead of single letters, which spreads out the letter-frequency patterns that make ciphers like Caesar and Atbash easy to break by counting how often each letter appears.
What happens to J in the Playfair cipher?
The 5x5 grid has only 25 cells for 26 letters, so I and J share one cell. J is treated as I when building the grid and when splitting your message into pairs.
Why do I sometimes see an extra X in decoded Playfair text?
X is the filler letter used to break up a doubled letter or pad an odd final letter before encryption. It has no meaning of its own and is simply dropped by eye when you read the decoded message.
Learn more
Go deeper on the ideas behind this tool.
Not sure this is the right tool?
If you have a message and you are not certain what it is, the cipher identifier reads the character set and the letter statistics and tells you which scheme it most likely uses, and why. It covers every code and cipher on this site.