Playfair cipher

Pairs of letters in a 5x5 keyword square, with the same row, same column and rectangle rules shown for every pair.

How it works

Invented by Charles Wheatstone in 1854 and promoted by Lord Playfair, it was used by the British in the Boer War and the First World War. A keyword without repeated letters, followed by the rest of the alphabet (I and J together), fills a 5 by 5 square.

The message is split into pairs; a filler (usually X) separates doubled letters and completes the last pair. Each pair is then replaced: in the same row, by the letters to their right; in the same column, by the letters below; otherwise the two letters are corners of a rectangle and each takes the corner in its own row. Decryption goes left and up instead. HIDE THE GOLD IN THE TREE STUMP with key PLAYFAIR EXAMPLE gives BMODZBXDNABEKUDMUIXMMOUVIF.

Working on pairs hides single letter frequencies, but there are only 600 possible pairs and their frequencies are just as typical of a language. A pair and its reverse encrypt to reversed pairs, and no letter ever encrypts to itself, which helps a solver with a few known words. Long messages fall to pair frequencies and hill climbing.

Everything is calculated in your browser. Nothing you type leaves your device.