Playfair Cipher
NewEncrypt and decrypt text with the classic Playfair digraph substitution cipher using a 5×5 key square built from your keyword, with the generated square shown.
5×5 key square (I/J merged)
Playfair encrypts pairs of letters (digraphs) rather than single letters using a 5×5 key square built from the keyword, with I and J sharing one cell. It was used operationally as early as the Boer War and both World Wars because digraph substitution resists simple frequency analysis far better than single-letter ciphers like Caesar or Vigenère.
Frequently Asked Questions
How is Playfair different from Caesar or Vigenère ciphers?
Playfair encrypts pairs of letters (digraphs) at a time using positions in a 5×5 key square, rather than shifting single letters one at a time — this digraph-based approach makes simple frequency analysis (which easily breaks Caesar/Vigenère) much less effective.
Why are I and J merged into one cell?
A 5×5 grid has only 25 cells but the English alphabet has 26 letters, so Playfair conventionally merges the least-distinguishable pair, I and J, into a single cell to make the alphabet fit; this tool automatically converts any J in your input to I.
What happens to repeated letters within a pair, like the double "T" in "letter"?
When both letters of a pair would be identical, an "X" is inserted between them to break up the pair (since Playfair can't meaningfully encrypt a doubled letter as a digraph) — the same padding rule is applied if the text has an odd number of letters, adding a trailing "X".
How is the key square constructed from my keyword?
The keyword is uppercased, has J converted to I, and duplicate letters removed, then the remaining unused letters of the alphabet are appended in order — this full 25-letter sequence fills the 5×5 grid row by row.
Was Playfair actually used historically?
Yes — it was invented in 1854 and used operationally by the British military as early as the Boer War, and by several countries during both World Wars, precisely because it resisted casual frequency-analysis attacks better than the simpler substitution ciphers common at the time.