Zero Signup ToolsFree browser tools

Developer Tools

Playfair Cipher

Encrypt and decrypt the classic Playfair digraph cipher in your browser. Live 5x5 key square, digraph breakdown, and I/J merge or Q-omit variants.

Letters fill the square first (duplicates removed), then the rest of the alphabet in order. Both sides must use the same keyword.

Splits doubled letters and pads an odd ending. Using X.

Square variant
31 chars

25 letters after cleaning. Spaces, digits, and punctuation are removed before processing.

Cipher text

BM OD ZB XD NA BE KU DM UI XM MO UV IF

Key square

I and J share a cell.

PLAYFI/JREXMBCDGHKNOQSTUVWZ

Highlighted cells show the first letter pair being processed.

Digraph breakdown

Every pair and the rule used to transform it.

Same rowSame columnRectanglePadded pair
HIBM
Rectangle
DEOD
Same column
THZB
Rectangle
EGXD
Rectangle
OLNA
Rectangle
DIBE
Rectangle
NTKU
Rectangle
HEDM
Rectangle
TRUI
Rectangle
EXXM
Padded pair
ESMO
Rectangle
TUUV
Same row
MPIF
Rectangle

How the rules work

  • Same row

    Replace each letter with the one to its right when encrypting, or the one to its left when decrypting. The row wraps around.

  • Same column

    Replace each letter with the one below it when encrypting, or the one above when decrypting. The column wraps around.

  • Rectangle

    Each letter stays in its row but takes the column of the other letter. This is the same rule for both encrypting and decrypting.

  • Padded pair

    A doubled letter or a lone final letter gets the padding letter inserted, so every pair has two different letters.

The Playfair cipher is a historical and puzzle cipher. It resists casual frequency analysis but is broken easily by modern methods, so use it for learning, capture-the-flag challenges, and puzzle hunts rather than protecting real secrets.

How to use

  1. Choose Encode to encrypt plain text or Decode to decrypt Playfair cipher text.
  2. Enter a keyword. It fills the 5x5 square first (duplicates removed), then the rest of the alphabet, and both sides must use the same keyword.
  3. Pick the square variant: merge I and J into one cell, or omit Q. Adjust the padding letter if you do not want the default X.
  4. Type or paste your text. Spaces, digits, and punctuation are stripped, and the cleaned letters are split into pairs automatically.
  5. Read the result, watch the key square highlight the active pair, and open the digraph breakdown to see the rule applied to each pair.
  6. Use Send to decode or Send to encode to round-trip the text, then copy the result, grouped into pairs or as a solid string.

About this tool

Playfair Cipher encrypts and decrypts text with the first practical digraph substitution cipher, invented by Charles Wheatstone in 1854 and championed by Lord Playfair, who gave it his name. Instead of substituting one letter at a time, it works on pairs of letters using a 5x5 key square, which flattens the single-letter frequencies that make a Caesar or simple substitution cipher easy to break by hand, and it saw real field use by the British in the Boer War and the First World War. This tool builds the square from a keyword you choose: the keyword letters fill the grid first with duplicates removed, then the rest of the alphabet follows in order. Because a 5x5 grid holds only 25 letters, one letter of the alphabet has to share a cell or be dropped, and the tool supports both common conventions. The default merges I and J into one cell (the classic textbook choice), and the alternative omits Q (mapping any Q in your text to K). Encryption splits the cleaned text into pairs and applies three rules: two letters in the same row each shift one place to the right, two letters in the same column each shift one place down, and any other pair forms a rectangle where each letter keeps its row but swaps to the other letter's column. Decryption reverses the row and column shifts and uses the identical rectangle rule. A doubled letter such as the pair in the word balloon cannot be encrypted, so the cipher inserts a padding letter (X by default, configurable) between them, and a lone final letter is padded the same way so every pair has two different letters. The live key square shows the exact grid in use and highlights the first pair being processed, and a digraph breakdown lists every pair, the letters it produced, and which of the four rules (same row, same column, rectangle, or padded) was applied, so you can follow the transformation step by step or check homework by hand. You can group the output into space-separated pairs the way Playfair output is traditionally written, swap the result back into the input to verify a round trip, and copy the result with one click. The Playfair cipher is a historical and recreational cipher: it resists casual frequency analysis but is broken quickly by modern cryptanalysis, so it belongs to learning, classwork, capture-the-flag challenges, escape rooms, and puzzle hunts rather than protecting real secrets. Everything runs locally in your browser, so the text and keyword you enter are never uploaded.

Free to use. Works in your browser. No signup, no login.

Related tools

You may also like

All tools
All toolsDeveloper Tools