Playfair cipher encoder

Playfair is a historical digraph cipher found in puzzles and cipher contests. It is a puzzle cipher that can be broken, not protection.

Loading the tool…

Processing and privacy: The result is calculated inside your browser and your data is not sent to any server.

How to use it

  1. Enter text and key.
  2. The result appears straight away and updates as you edit.
  3. Copy the result, or copy a link that keeps the same values to share it.

How it is calculated

The square holds the key letters without repeats, then the rest of the alphabet (J merged with I). Doubled letters are split with X (Q if the letter is X) and an odd last letter is padded the same way. Same row: letter to the right; same column: letter below; otherwise: the rectangle corners on the same row.

Example

Inputs: Key = PLAYFAIR EXAMPLE. Result: Encoded text: BM OD ZB XD NA BE KU DM UI XM MO UV IF.

Hide the gold in the tree stump
BM OD ZB XD NA BE KU DM UI XM MO UV IF

Limits and caveats

  • This is a puzzle and teaching cipher that is easy to break, so never use it to protect passwords or sensitive data.
  • Spaces, symbols and digits are dropped, and J is written as I.
  • Filler rules differ between sources; here X is used, or Q when the letter is X.

Questions about this tool

Why is J merged with I?

The square has only 25 cells, so one of 26 letters must go, and the usual convention merges J into I.

Why did an X appear in my text?

X is inserted between two identical letters in one pair, and at the end when the letter count is odd.

Can the key be empty?

Yes. The square is then the plain alphabet in order, without J.