Two-Square Cipher

Two squares
Top (Keyword 1)
EXAMP
LBCDF
GHIKN
OQRST
UVWYZ
Bottom (Keyword 2)
KEYWO
RDABC
FGHIL
MNPQS
TUVXZ
HECMXWSRKYXPHWNODG
Transformed locally in your browser. The two keywords build the top and bottom 5×5 squares (J merged into I). The message is normalized to uppercase A–Z — spaces, digits, and punctuation are dropped — then split into letter pairs, padding an odd length with a trailing X. For each pair the first letter is found in the top square and the second in the bottom square; the ciphertext swaps their columns within the same two squares (a pair sharing a column passes through unchanged). The transform is its own inverse, so the same operation encodes and decodes. Output is always uppercase A–Z, so case, digits, and symbols are not preserved, and the I/J merge plus any X filler remain in decoded text.

Encode digraphs through two keyword squares

The two-square cipher, also called double Playfair, encrypts pairs of letters through two keyed 5×5 squares. For each plaintext pair, the first letter is located in the top square and the second in the bottom square; the ciphertext keeps each letter in its own square but swaps the two columns. It is stronger than Playfair, which keys a single square, and simpler than the four-square cipher, which uses four.

When to use this tool

Reach for the two-square cipher — also known as double Playfair — when a puzzle, CTF challenge, escape room, or cryptography lesson encrypts letter pairs through two keyword squares. It is the missing middle of the Playfair family: stronger than Playfair, which keys a single square, and simpler than the four-square cipher, which uses four. Stacking two keyed 5×5 squares spreads each digraph across both, so a single square is no longer enough to read the message. It sits naturally beside the Playfair and Four-Square tools, completing the digraph and square family of classical ciphers here.

Privacy and limitations

Everything runs locally in your browser; nothing is sent anywhere. This is a classical cipher, not real encryption — two known keywords make it trivial to reverse. Both squares merge J into I, so I and J share one cell and both decode back to I; encoding is case-insensitive and drops every non-letter before pairing. Output is uppercase letters only, an odd-length message is padded with a trailing X, and original case, spacing, and punctuation are not recovered — a round-trip returns the cleaned, uppercased message (with any padding) rather than your exact input. Both keywords are optional; an empty keyword yields the plain A–Z square. The two-square transform is its own inverse, so the same operation both encodes and decodes — the Encode/Decode toggle simply swaps the sample text.