Playfair Cipher

Inputs

Letters only; repeats are skipped. I and J share a cell.

Results

Key square

Invented by Charles Wheatstone in 1854 and promoted by Lord Playfair, this cipher was used by the British Army into the First World War. It encrypts pairs of letters instead of single ones, which hides letter frequencies better than Caesar or simple substitution and still works with pencil and paper.

How to use it

  1. Choose Encode or Decode and type the keyword.
  2. Type the message. Only letters are used: J counts as I, an X is put between doubled letters in a pair, and an X pads an odd length.
  3. For each pair: same row → take the letters to the right; same column → the letters below; otherwise → the other two corners of their rectangle.

Example: “Hide the gold in the tree stump” with the keyword PLAYFAIR EXAMPLE encodes to BM OD ZB XD NA BE KU DM UI XM MO UV IF.

Questions and answers

Why are there extra X letters after decoding?

They were added when encoding to split doubled letters (TREE → TR EX ES) and to fill the last pair. Readers simply ignore them.

Is Playfair secure?

No. With enough cipher text it can be broken by hand, as codebreakers did in both World Wars. Use it for puzzles and history.

Why do I and J share a cell?

A 5×5 square has room for 25 letters, so one pair has to share. Merging I and J is the usual choice; the message still reads fine.

Link with pre-filled values

Add # and these parameters to the end of this page's address to open the tool with values already filled in.

ParameterWhat it sets
textThe message, or the cipher text to decode.
keyThe keyword (letters A–Z).
modeencode or decode.

Example: https://toolabelle.com/playfair-cipher/#text=Meet+me+at+the+bridge&key=MONARCHY&mode=encode

Related tools