← Back to Home

Playfair Cipher

The first practical digraph substitution cipher.

About the Cipher

Invented in 1854 by Charles Wheatstone, but named after Lord Playfair who promoted its use, this cipher encrypts pairs of letters (digraphs) instead of single letters. It was used by British forces in World War I and World War II for its speed and relative security compared to simple substitution.


How It Works

  • Generate a 5x5 Matrix: Fill a grid with a keyword (removing duplicate letters) and complete it with the rest of the alphabet (combining I and J).
  • Prepare the Text: Split the message into pairs. If a pair has the same letter, add an 'X'. If the total length is odd, add an 'X' at the end.
  • Apply Rules:
    Same Row: Shift each letter to the right.
    Same Column: Shift each letter down.
    Rectangle: Swap letters with those in the same row but opposite corners.

Interactive Tool

...