Playfair Cipher

The Playfair cipher is an interesting cipher that replaces pairs of letters with other pairs. Simpler substitution ciphers only replace single letters. This makes hacking the encryption much harder.


To encrypt a message, you'll need to pre-treat it. First replace all Js with Is and remove the spaces. Secondly, split the plain text into pairs of letters. If any pair is a double letter then put an X in between them. Your pair of letters is now a triple! So take the third letter and move it into the next pair. Continue until you have only pairs. If you have a single letter at the end, add an extra X to the end to make a pair.

For example the message "Just you see" would be treated like this:

  3. IU, ST, YO, US, EE
  4. IU, ST, YO, US, EXE
  5. IU, ST, YO, US, EX, E
  6. IU, ST, YO, US, EX, EX

Take the letters two at a time from your treated plain text and apply the following rules:

Repeat this method for each pair of letters in the message.


To decrypt a message you must go through the letters in the cipher text two by two. Apply the following rules:

You may end up with a plaintext that has extra Xs in it. You can ignore those, hopefully the message still makes sense.

Making Your Own Key

To make your own grid (and therefore your own secret key) you must fill a 5x5 grid with letters. The grid will only have space for 25 letters in total, so don't use J or space. Fill your 5x5 grid with letters at random. Don't re-use letters and don't miss any out.


Here's a grid that you can edit. When you change the letters in the grid the key will update and the example plaintext will be encrypted for you. Can you see how it all works?



Register Group

Sign In