Productivity and Utilities

Playfair Cipher Tool

Enter a key phrase and a message to encrypt or decrypt it with the Playfair square.

Your numbers

Action

Letters only matter. J counts as I.

Spaces, digits and punctuation are dropped. Up to 3,000 characters.

Result

Ciphertext

BMODZBXDNABEKUDMUIXMMOUVIF

13 letter pairs. Fillers stay in the decrypted text.

Ciphertext
BMODZBXDNABEKUDMUIXMMOUVIF
Prepared pairs
HI DE TH EG OL DI NT HE TR EX ES TU MP
Result pairs
BM OD ZB XD NA BE KU DM UI XM MO UV IF

Key square

Col 1Col 2Col 3Col 4Col 5
PLAYF
IREXM
BCDGH
KNOQS
TUVWZ

Pairs

Input pairResult pair
HIBM
DEOD
THZB
EGXD
OLNA
DIBE
NTKU
HEDM
TRUI
EXXM
ESMO
TUUV
MPIF
How this was calculated
  1. Write the key letters without repeats into a 5 x 5 square, then the unused letters of the alphabet in order. I and J share one cell.
  2. Split the message into pairs. A pair of equal letters gets X inserted between them, and an odd last letter gets X added.
  3. Two letters in the same row move one cell right; in the same column, one cell down; otherwise each takes the cell in its own row and the other letter's column. The edges wrap around.
  • Playfair was a field cipher in the early 1900s. It is easy to break with a computer, so use it for puzzles and teaching, not for secrets.

Calculated using SumPanda.com · https://sumpanda.com/playfair-cipher-tool/

Results are estimates for general information. Verify important figures before relying on them.

Next step

How to use the playfair cipher tool

  1. Choose Encrypt or Decrypt.
  2. Enter the key phrase. Only letters count, repeated letters are dropped, and J is treated as I.
  3. Type the message. For encryption, spaces, digits and punctuation are removed. For decryption, paste the ciphertext.
  4. Read the result, the key square and the table of letter pairs. Optionally change the filler letter used between double letters.

Formula

Key square: the key letters without repeats, then the rest of the alphabet, in a 5 x 5 grid with I and J together

Same row: each letter is replaced by the one to its right (left to decrypt), wrapping around

Same column: each letter is replaced by the one below (above to decrypt), wrapping around

Rectangle: each letter is replaced by the one in its own row and the other letter's column

Before encrypting, the message is cut into pairs. A pair of equal letters gets the filler between them, and an odd last letter gets the filler added.

The classic key PLAYFAIR EXAMPLE

With the key PLAYFAIR EXAMPLE the square has the rows PLAYF, IREXM, BCDGH, KNOQS and TUVWZ. The message HIDE THE GOLD IN THE TREE STUMP becomes the pairs HI DE TH EG OL DI NT HE TR EX ES TU MP (the double E gets an X between), and the ciphertext is BMODZBXDNABEKUDMUIXMMOUVIF. Decrypting it returns HIDETHEGOLDINTHETREXESTUMP, with the filler X still in place.

With the key MONARCHY, the message INSTRUMENTS becomes the pairs IN ST RU ME NT SX and the ciphertext GATLMZCLRQXA, where the final X was added to complete the last pair.

How Playfair works

Playfair was one of the first ciphers to work on pairs of letters instead of single letters. Because a letter is replaced differently depending on its partner, simple letter counting does not work as easily as for a Caesar cipher. It was used by armies in the early twentieth century for short field messages, since the key square is easy to memorize and use without any equipment.

The method has quirks. J and I share a cell, so J is read as I. An X, or another filler, is added between double letters and at the end, and it stays in the decrypted text; you have to remove it by eye. The ciphertext never contains a pair of identical letters, which helps in breaking it.

Learning and puzzles

Use it to learn how substitution ciphers grow stronger, or to build puzzles. A Playfair message is far more work to break by hand than a Caesar shift, but computers break it easily by trying likely keys and scoring the text. It must not be used for anything that needs real privacy.

To study letter patterns in a ciphertext, use the letter frequency counter. To compare with a simple shift, try the Caesar cipher; for a message turned into dots and dashes, the Morse code translator; and for a transposition cipher, the rail fence cipher tool.

Assumptions and limits

  • The square has 25 cells, so J and I share one and the message is read with J as I.
  • The filler letter is X unless you choose Q or Z. If the pair is already the filler, Q is used.
  • Decrypted text keeps its fillers and has no spaces.
  • The message can be up to 3,000 characters.

Formulas reviewed October 10, 2026. See the calculation methodology for how SumPanda rounds, tests and sources its formulas.

Frequently asked questions

What is the Playfair cipher?

A digraph cipher from the nineteenth century that encrypts pairs of letters using a 5 by 5 square built from a key phrase.

Why is there an X in my decrypted message?

It is the filler that was added to split a double letter or to fill the last pair. Remove it when reading.

What happens to J?

It is merged with I, so both use the same cell in the square.

Is Playfair secure?

No. It is stronger than a simple shift but is easily broken with a computer, so use it only for puzzles and teaching.