Your country

Tools that support it use your country for local currency, number formats, units and paper size. Your choice is saved only in this browser.

Type a name or a two-letter code. Use the up and down arrow keys to move through the countries, Enter to choose one and Escape to close.

Playfair Cipher

Build the 5 × 5 key square and watch each pair of letters move on it.

Free, no sign-up On this device: nothing is sent
+3 +1 more details No uploadWorks offline once opened Security

Its letters fill the square first, without repeats; the rest of the alphabet follows.

Goes between equal letters and after an odd last letter.

Used when the filler itself is doubled (XX) or last.

Key square

The 5 × 5 key square, row by row
·····
·····
·····
·····
·····

from the keyword the pair what it becomes

Type a message to step through it.

Encrypted text

Type a message above.

How the text is prepared
  1. Keep the letters A–Z only (accents are removed), in capitals.
  2. J becomes I, because I and J share a cell.
  3. Split the letters into pairs. A pair of two equal letters gets the filler between them, and the second letter starts the next pair.
  4. If one letter is left over at the end, the filler completes the last pair.

Every pair, step by step

    Next steps Done. What next?

    Start over

    All security & privacy tools

    About the Playfair Cipher

    The Playfair cipher encrypts pairs of letters instead of single ones, which hides the letter frequencies that break simpler ciphers. Charles Wheatstone invented it in 1854, and it carries the name of Lord Playfair, who promoted it; armies used it as a field cipher for decades. Everything turns on a 5 × 5 key square: the letters of a keyword, without repeats, followed by the rest of the alphabet — with I and J sharing a cell, or with Q left out, so that 25 letters fit.

    This page builds the square from your keyword, prepares your text the way the cipher requires (pairs of letters, a filler between doubled letters, another at the end of an odd number of letters) and encrypts or decrypts it. Step through the pairs to see each one on the square: the two letters, the rule that applies — same row, same column or rectangle — and the letters they become. When decrypting, the likely fillers can be taken out again. Everything runs in your browser.

    How to use it

    1. Type a keyword and choose the square: I and J sharing a cell (the usual way) or Q left out.
    2. Choose Encrypt or Decrypt and type or paste your text. Spaces, digits and punctuation are left out; J becomes I (or Q is dropped).
    3. Read the result, shown in pairs, in groups of five or without spaces.
    4. Press ‹ and › beside the square to follow each pair, or open Every pair, step by step and press a pair to show it on the square.
    5. When decrypting, keep Remove the likely fillers ticked to take out the X between doubled letters and at the end, then copy, download or reuse the result.

    Examples

    Keyword “playfair example”
    Input
    Hide the gold in the tree stump
    Result
    BM OD ZB XD NA BE KU DM UI XM MO UV IF

    The square starts PLAYF / IREXM. The doubled E of TREE is split with an X: TR EX ES. HI is a rectangle, so H and I take the corners in their own rows: B and M.

    Keyword MONARCHY, padded with Z
    Input
    instruments
    Result
    GA TL MZ CL RQ TX

    A common textbook example: with Z as the filler, the odd last S becomes the pair SZ, a rectangle that gives TX.

    Decrypting with fillers removed
    Input
    BMODZBXDNABEKUDMUIXMMOUVIF (keyword “playfair example”)
    Result
    HIDETHEGOLDINTHETREESTUMP

    Decrypted exactly, the text reads …TREXESTUMP; the X between the two Es is a filler and is removed.

    Common uses

    • Solving puzzles, escape rooms and geocaches that give a Playfair keyword.
    • Teaching how a digraph cipher hides single-letter frequencies, and how it still leaks pair patterns.
    • Checking homework or exam answers worked by hand on a key square.
    • Making a secret message for a game, with the square drawn out for the reader.

    The three rules

    • Same row: each letter is replaced by the letter to its right; the last letter of a row wraps round to the first. Decryption moves left.
    • Same column: each letter is replaced by the letter below it; the bottom wraps round to the top. Decryption moves up.
    • Rectangle (different row and column): each letter is replaced by the letter in its own row and in the column of the other letter — the opposite corners of the rectangle the two letters make. The rule is its own inverse.

    A pair is never two equal letters, which is why the filler is needed: with the keyword “playfair example”, the E E of tree would have no rule to follow.

    Fillers and the end of the message

    Before encrypting, a filler — usually X — goes between two equal letters that would fall in the same pair (BALLOON → BA LX LO ON) and after a last letter left on its own. When the letter to separate or complete is the filler itself, a second filler (usually Q or Z) is used instead; the square without Q has no cell for Q, so with it the page makes Z the second filler. After decrypting, a filler can look like a real letter: the page removes an X that stands between two equal letters or at the very end, which is almost always right — but a real X in the same place (as in exes) would go too, so you can untick the box to see every letter.

    How Playfair is broken

    Playfair hides single-letter frequencies, but not pair frequencies: a common pair such as TH always encrypts the same way under one key, and a pair and its reverse (TH and HT) encrypt to reversed pairs. With a few hundred letters of ciphertext, cryptanalysts rebuild the square from these patterns, by hand or with a computer search. Use it for puzzles and teaching, never for real secrets.

    Limitations

    • Only the 26 letters A–Z take part: spaces, digits, punctuation and other scripts are dropped, and accented letters lose their accents (é → E).
    • J is written as I in the I/J square, so a decrypted message shows I where J was; the Q-less square drops every Q.
    • Removing fillers is a guess: decrypting cannot tell a filler from a real letter in the same position.
    • The page does not crack Playfair without the keyword: finding the square needs a statistical search on long ciphertexts.

    Privacy

    On this device: nothing is sent

    Everything happens in your browser. What you enter or open here is not uploaded or stored by MySmartCoPilot.

    Frequently asked questions

    How do I decrypt a Playfair cipher?

    Choose Decrypt, type the keyword and paste the ciphertext. Each pair is reversed: a row pair moves left, a column pair moves up, and a rectangle swaps corners as before. The result keeps the fillers unless Remove the likely fillers is ticked.

    Why are I and J in the same cell?

    The square has 25 cells for 26 letters, so one letter has to share or go. Merging I and J is the usual choice because J is rare and easy to guess from context; leaving out Q is the other common way.

    What if my ciphertext has an odd number of letters?

    Then it was not made with Playfair, or a letter was lost when it was copied: every Playfair ciphertext is a whole number of pairs. The page says so instead of guessing.

    Why does my result contain extra X letters?

    X is the filler that splits doubled letters (TREE → TR EX E…) and completes an odd last letter. Decrypting brings it back as part of the text; Remove the likely fillers takes it out again.

    Who invented the Playfair cipher?

    Charles Wheatstone, the English scientist, in 1854. His friend Lord Lyon Playfair promoted it to the British government, and it took his name.

    Quick answers and tool search

    Type to search tools or to get a quick answer, for example 18% of 2500. Use the up and down arrow keys to move through the results, Enter to choose, and Escape to close.