Digraph substitution / 5x5 square

Playfair cipher

Encrypt or decrypt the classic English Playfair cipher with a keyword-built square and explicit filler rules.

01 / Workspace

Encrypt a message

A-Z / I and J merged
Mode

The selected direction is always used. This tool does not guess a mode, keyword, or variant.

0 / 128 code points

ASCII letters are uppercased, J becomes I, and repeats are removed in first-seen order. Spaces, punctuation, digits, accents, emoji, and other scripts are ignored but remain in this field.

Output option

Adds one space after every result pair. Copy includes those spaces exactly.

Key square

Enter a keyword and run the selected mode.

0 / 10,000 code points

Encryption keeps only ASCII letters, uppercases them, and maps J to I. Every other code point is omitted and counted in the status.

Keyboard: press Ctrl+Enter or Command+Enter anywhere in the tool to run the selected mode.

Ready to encrypt.

02 / Result

Result

No result yet

The result is uppercase ASCII and contains no original spacing or punctuation.

03 / Exact convention

How this Playfair variant works

  1. Build the square. Normalize the keyword as described above, keep its first occurrence of each letter, then append unused letters from ABCDEFGHIKLMNOPQRSTUVWXYZ. I and J share the I cell.
  2. Prepare plaintext. Read normalized letters from left to right. A repeated pair gets an X after its first letter, except X gets Q. The second repeated letter is reconsidered in the next pair. A final unpaired letter gets the same filler rule.
  3. Transform pairs. Encrypt letters in one row by moving right and letters in one column by moving down, wrapping at edges. Decrypt moves left or up. Rectangle pairs keep their rows and take each other's columns in both directions.
  4. Validate ciphertext. Decryption accepts ASCII A-Z or a-z except J or j, uppercases them, and removes spaces, tabs, and line breaks used for grouping. It requires an even number of letters, rejects repeated-letter pairs, and rejects all other characters without changing the input.

Known-answer check

Keyword
PLAYFAIR EXAMPLE
Plaintext
HIDE THE GOLD IN THE TREE STUMP
Prepared text
HIDETHEGOLDINTHETREXESTUMP
Ciphertext
BMODZBXDNABEKUDMUIXMMOUVIF

Limits and security

  • Decryption returns prepared uppercase text. It cannot recover J instead of I, original case, spaces, punctuation, or other discarded characters.
  • X and Q can be genuine letters or inserted fillers, so the tool never removes them automatically. For example, decrypting an encryption of BALLOON includes the inserted X and needs human interpretation.
  • The keyword is limited to 128 Unicode code points and message input to 10,000. Encryption produces at most 20,000 result letters; optional digraph grouping adds spaces.
  • Browser text controls normalize CR and CRLF line endings to LF. Accepted grouping line breaks have no effect on decryption output.
  • Playfair is a historical puzzle cipher that can be broken with modern methods. Do not use it to protect passwords, personal data, authentication material, or confidential messages.