Playfair Cipher

Key square
PLAYF
IREXM
BCDGH
KNOQS
TUVWZ
BMODZBXDNABEKUDMUIXMMOUVIF
Transformed locally in your browser. The keyword builds a 5×5 key square (J merged into I), and the message is normalized to uppercase A–Z — spaces, digits, and punctuation are dropped — then split into letter pairs with an X filler between doubled letters (Q when the doubled letter is X) and a trailing filler for an odd length. Output is always uppercase A–Z, so case, digits, and symbols are not preserved, and decoding does not undo the I/J merge or remove inserted fillers — round-trips are close but not exact.

Encode digraphs with a keyword square

The Playfair cipher encrypts pairs of letters rather than single letters. For each pair, two letters in the same row shift right, two in the same column shift down, and any other pair swaps columns to form a rectangle — making it far harder to break than a simple substitution cipher.

When to use this tool

Reach for the Playfair cipher when a puzzle, CTF challenge, or cryptography lesson uses the classic digraph substitution that encrypts letters two at a time. Invented in 1854 and the first practical literal digraph cipher, it is the most widely taught step beyond simple letter-for-letter schemes, so it rounds out the classical family here (Caesar, Vigenère, Atbash, Affine, Polybius) with a 5×5 keyword square instead of a single shift or coordinate map.

Privacy and limitations

Everything runs locally in your browser; nothing is sent anywhere. This is a classical cipher, not real encryption. Standard Playfair only — there is no 6×6 alphanumeric square, no custom filler beyond the X/Q rule, and no four-square or two-square variant. Output is always uppercase A–Z: the keyword merges J into I, and the message is stripped of spaces, digits, and punctuation before encoding, so case and non-letters cannot be preserved. Round-trips are close but not exact — decoding cannot tell an original I from a merged J, and the X or Q fillers inserted between doubled letters and at an odd-length tail remain in the decoded text. Use the encode/decode toggle to switch directions, since the transform is not self-inverse.