Sheffield Flourish Cast Writers' Group

Playfair Cipher HOWTO

by Brian

posted on 2026_10_20

The Playfair cipher is a manual encryption system invented in the nineteenth century. Unlike simple substitution ciphers that encrypt individual letters, Playfair encrypts pairs of letters, known as digraphs. This makes frequency analysis more difficult and was considered a significant improvement in its day.

ENCRYPTION

A 5 X 5 grid of letters is constructed from a keyword. The letters of the keyword are written into the grid first, omitting any repeated letters. The remaining letters of the alphabet are then added in order. Since the grid contains only 25 spaces, the letters I and J are combined and occupy a single cell. Thus, whenever a J appears in a message it is treated as I.

Thus, with a keyword of YELDRING, the constructed grid is:

Y E L D R
I N G A B
C F H K M
O P Q S T
U V W X Z

Before encryption, the plaintext is divided into pairs of letters, and then:

  1. Spaces and punctuation are removed.
  2. J is replaced by I.
  3. If a pair contains the same letter twice, an X is inserted between them.
  4. If the message contains an odd number of letters, an X is added at the end.

With a plaintext of BILLY WILLIAMS.

Remove spaces:
BILLYWILLIAMS

Split into pairs, adding an X at the end to make even:
BI LL YW IL LI AM SX

The pair LL contains a double letter, so insert X. Trailing X no longer needed:
BI LX LY WI LL IA MS

The new LL must also be separated and an X added at the end to make even:
BI LX LY WI LX LI AM SX

The pairs of letters are each encrypted using the grid following the following rules:

  • Same row: Replace each letter with the letter immediately to its right, wrapping round to the beginning of the row if necessary.
  • Same column: Replace each letter with the letter immediately below it, wrapping round to the top if necessary.
  • Rectangle rule: If the letters form opposite corners of a rectangle, each letter is replaced by the letter in the same row but in the column of the other letter.

Following these rules, the adjusted plaintext encrypts into:
IN DW DE UG DW YG BK XD
which can then be written with the spaces removed or in any form desired.

DECRYPTION

To decrypt the cipertext TFFDXFMCLPNB using the keyword EXACTION.

with a keyword of EXACTION, the constructed grid is:

E X A C T
I O N B D
F G H K L
M P Q R S
U V W Y Z

Separate the ciphertext into pairs of letters:
TF FD XF MC LP NB

The pairs of letters are each decrypted using the grid and the following rules:

  • Same row: Replace each letter with the letter immediately to its left, wrapping round to the beginning of the row if necessary.
  • Same column: Replace each letter with the letter immediately above it, wrapping round to the top if necessary.
  • Rectangle rule: If the letters form opposite corners of a rectangle, each letter is replaced by the letter in the same row but in the column of the other letter.

Following these rules, the ciphertext decrypts into:
EL LI EG RE GS ON or probably ELLIE GREGSON


HTML5 logo