Skip to content
100% local

Playfair cipher

Encrypt or decrypt text with the classic Playfair cipher, using a keyword-built 5×5 letter table.

Input
Output

Playfair cipher

The Playfair cipher is a classical encryption method from 1854 that enciphers pairs of letters rather than single characters, making it far harder to break with simple frequency analysis than a Caesar or substitution cipher. This tool builds a 5×5 letter table from your keyword, splits your text into letter pairs and encrypts or decrypts each pair with the row, column and rectangle rules the cipher is known for — useful for cryptography lessons, puzzle hunts, CTF challenges or exploring how a pre-computer cipher works.

Type a keyword to seed the table; its letters come first, followed by the rest of the alphabet. Since the table has 25 cells, choose whether to merge I and J into one cell (the traditional approach) or drop Q entirely. Pick a direction, a filler letter used to split a doubled letter and pad a trailing odd one (defaulting to X, with an automatic fallback), and whether diacritics are folded to plain Latin so accented text becomes cipherable, or excluded instead. The output can be grouped into blocks of five characters or left continuous.

Spaces, digits and punctuation are removed before pairing, since Playfair needs a continuous run of letters. A doubled letter inside a pair (the two L's in "BALLOON") gets a filler inserted between them, and an odd-length message gets one appended at the end; decrypting recovers those fillers as ordinary output, since there is no reliable way to tell them apart from real letters afterwards. Turn on "Show table and letter pairs" to see exactly how your text was split, or off for just the result.

Everything runs locally in your browser — your keyword and text are never uploaded. Copy the result, download it as a .txt file, or send it back into the input to chain another transformation.

FAQ

How does the Playfair cipher encrypt a pair of letters?
Both letters of a pair are located in the 5×5 table. If they share a row, each is replaced by the letter to its right (wrapping around). If they share a column, each is replaced by the letter below it. Otherwise, each letter is replaced by the one in its own row but in the other letter’s column — the "rectangle" rule.
Why did a doubled letter turn into two different letters?
Playfair pairs letters two at a time, and a pair can’t contain the same letter twice, so the filler letter is inserted between them — "BALLOON" becomes BA, LX, LO, ON before encryption.
What's the difference between merging I/J and omitting Q?
The table has 25 cells for a 26-letter alphabet, so one letter has to go. The classic approach treats I and J as the same letter; the alternative simply drops Q from the table and from the text, keeping I and J distinct.
Why does the decrypted text sometimes have an extra letter?
That extra letter is a filler that was inserted during encryption to split a doubled letter or pad an odd-length message. Decryption recovers exactly what was encrypted, filler included, since there is no reliable way to tell a real letter from an inserted one afterwards.
Is my text or keyword uploaded anywhere?
No. The Playfair cipher runs entirely in your browser — your keyword and text never leave your device.