Playfair encodes pairs of letters using a 5 × 5 square built from your key. Some messages need extra letters to form valid pairs. The tool shows both your original message and its prepared form, so you can see those changes before reading the result.

Build the keyed square

Start with an A–Z key, change J to I, and keep only the first appearance of each letter. Fill the rest of the square with unused alphabet letters. Here is the square for MONARCHY.

Row12345
1MONAR
2CHYBD
3EFGIK
4LPQST
5UVWXZ

Prepare the pairs

  • Remove nonletters and merge J into I, with the changes shown.
  • Read letters in pairs. If both would match, insert X after the first and reconsider the second letter.
  • When the repeated letter is X, insert Q instead.
  • If a final letter has no partner, append X; if that final letter is X, append Q.

Follow the inserted filler

InputBALLOON
SettingsKey MONARCHY; prepared plaintext BALXLOON
Expected resultIBSUPMNA
Try this method

BALLOON becomes BA LX LO ON. The added X separates the two L letters into different pairs; it was not in the original word.

Transform each pair

  • Same row: move each letter one cell right, wrapping at the edge.
  • Same column: move each letter one cell down, wrapping at the bottom.
  • Different row and column: take the other two corners of the rectangle, keeping each letter in its original row.

To decode, move left in a shared row or up in a shared column. The rectangle rule stays the same. IBSUPMNA decodes to BALXLOON. The tool leaves the X in place because removing every X could also remove a real letter from another message.

Try one yourself

With key MONARCHY, prepare XX before encrypting it. Why is XX not a valid prepared pair?

Keep exploring

Why Playfair adds filler lettersHow text conversion and preparation workCheck a puzzle before printing