Playfair Cipher Converter

Encrypt or decrypt letter pairs with a keyed five by five square.

Technology and NetUpdated 2026-11-192 min read
Playfair Cipher Converter
Up to 200 characters. Non letters are removed and J is treated as I.
Letters only, 1 to 25 characters. Repeated letters are dropped.
Converted message
...
Key square...
Letter pairs used...

What it does

The Playfair cipher encrypts pairs of letters using a five by five square built from a keyword. It was invented by Charles Wheatstone and named after Lord Playfair, who promoted it in the nineteenth century.

This tool builds the key square by writing the keyword without repeated letters, then filling the remaining cells with the rest of the alphabet in order, combining I and J into one cell. It then applies the three geometric rules to each digraph.

The page opens with the message SHEWENTTOTHESTORE and keyword PROBLEMS. The doubled T in the middle is split with a Q, and the resulting ciphertext is AGMVMKUTQBYTMAQBPM.

For a pair in the same row, each letter moves one cell to the right with wrapping. For the same column, each moves one cell down. For a rectangle, each letter is replaced by the letter in its own row and the other letter's column.

The cipher was considered strong for its time because it hides single letter frequencies, but it is easily broken with modern methods.

How to use

  1. Type the message to encrypt or decrypt.
  2. Enter a keyword made of letters.
  3. Choose encrypt or decrypt.
  4. Read the converted message as the main result.
  5. Check the key square to follow the letter positions.
  6. Look at the digraphs to see where filler letters were inserted.

Formula

Same row: shift right. Same column: shift down. Otherwise: swap columns of the two letters in their rows
key square
The 5 by 5 grid built from the keyword.
digraph
A pair of letters encrypted together.
filler
A Q inserted to split doubled letters or complete an odd final pair.

Decryption reverses the row and column shifts and uses the same rectangle operation, which is its own inverse. Filler letters inserted during encryption must be removed by context after decryption.

Worked example

Example: SHEWENTTOTHESTORE with keyword PROBLEMS

The page opens with keyword PROBLEMS and the message SHEWENTTOTHESTORE.

  1. Build the square beginning PROBLEMS, then fill with A C D F G H I K N Q T U V W X Y Z.
  2. Split the message into pairs: SH EW EN TT OT HE ST OR E.
  3. The doubled TT becomes TQ, and the final single E becomes EQ.
  4. Apply the row, column and rectangle rules to each pair.
  5. The digraphs SH EW EN TQ TO TH ES TO RE produce AG MV MK UT QB YT MA QB PM.
  6. The tool reports the ciphertext AGMVMKUTQBYTMAQBPM.

Reference table

Sample Playfair settings
MessageKeywordResult
SHEWENTTOTHESTOREPROBLEMSAGMVMKUTQBYTMAQBPM

Limits

  • Messages are limited to 200 characters.
  • Keyword must be 1 to 25 letters.
  • I and J share one cell, so the cipher cannot distinguish them.
  • Filler letters must be removed by context after decryption.

Common mistakes

  • Using a keyword with repeated letters without removing them.
  • Forgetting that J is treated as I.
  • Encrypting doubled letters in the same pair directly.
  • Shifting left instead of right during encryption.
  • Expecting the filler Q to be removed automatically.

Try it yourself

Quick checks. Answers sit tucked under each question.

How many letters fit in the Playfair square?

25, with I and J sharing a cell.

What is done with a doubled letter pair?

A Q is inserted between them.

What happens for letters in different rows and columns?

Each is replaced by the letter in its row and the other letter's column.

Questions

Who invented the Playfair cipher?

Charles Wheatstone, with promotion by Lord Playfair.

Why encrypt pairs?

Pair encryption hides single letter frequencies better than simple substitution.

How is the square built?

Keyword first without repeats, then the remaining alphabet in order.

Why combine I and J?

A 5 by 5 grid has only 25 cells for 26 letters.

Is the rectangle rule reversible?

Yes, applying it again returns the original pair.

Is Playfair secure today?

No. It is a classical cipher broken by modern cryptanalysis.

Sources

How this page was checked. The formula above was matched against the cited sources, and the worked example was run through the tool on this page before publishing. If you spot an error, contact us so we can fix it and note the correction.