Four-square cipher
Encrypt or decrypt text with the classic Four-square polygraphic substitution cipher.
Four-square cipher
The Four-square cipher is a classical polygraphic substitution cipher invented by Félix Delastelle. It encrypts pairs of letters at a time using four 5x5 (or 6x6) grids arranged in a square: two plain alphabet grids in the top-left and bottom-right, and two grids seeded by your own passwords in the top-right and bottom-left. Paste plaintext to encrypt it, or ciphertext to decrypt it back.
Set a password for the top-right square and a different one for the bottom-left square — each keyword's unique letters fill the grid first, followed by the rest of the alphabet. Choose whether I and J share one cell (the classic 25-letter alphabet) or keep separate cells by switching to the 36-character alphabet, which also adds the ten digits. Pick a filler letter to pad an odd-length message before pairing, and choose whether the result is grouped into two-letter blocks or printed as one continuous run. Turn on "Show cipher squares used" to print all four grids beneath the result, so you can check exactly how each pair was mapped.
Decryption expects an even number of letters — an odd count means a character is missing, and the tool tells you so instead of guessing. Spaces, punctuation and (at 25 letters) digits are dropped from the letter stream rather than encrypted, and accented letters are folded to their plain form before mapping, the same way the classical cipher was used on paper.
Everything runs locally in your browser — passwords and text are never uploaded anywhere. Copy the result, download it as a .txt file, or send the output straight back into the input to encrypt or decrypt another round.