Skip to main content
PixelTools

Playfair cipher

Encode or decode text with the Playfair cipher and your own keyword. Free, private — nothing leaves your device.

0 characters
Ciphertext0 characters
Your Playfair result will appear here.

Everything you need to work a Playfair message

Your keyword, your square

Type any keyword and the 5x5 key square is built for you, with repeated letters removed and I and J sharing a cell.

Live results

The result updates as you type. No button to press.

Double letters handled

Repeated letters in a pair and an odd last letter get an X filler (a Q when the letter is itself X), the standard Playfair rule.

100% private

Runs entirely in your browser. Nothing you type is uploaded or stored.

Encode or decode in three steps

  1. 1

    Enter a keyword

    Type the keyword you and the other person agreed on. It sets up the 5x5 letter square the whole cipher depends on.

  2. 2

    Choose encode or decode, then paste your text

    Pick the direction and type or paste your message. Playfair works on pairs of letters, so the result appears in pairs.

  3. 3

    Copy or download the result

    The text updates live as you type. Copy it, download it as a .txt file, or use swap to feed the result back in and check your work.

Built for learning, puzzles, and quick checks

Playfair was a real field cipher in the early 1900s. Today it's best for teaching, puzzles, and checking hand-worked answers, not for real security.

Cryptography coursework

Check a hand-worked Playfair answer instead of redoing the square by hand.

Puzzle hunts and escape rooms

Playfair clues show up in puzzle hunts. Paste the ciphertext, type the keyword, and read the answer.

Geocaching and CTF warm-ups

Decode a known-keyword Playfair clue quickly and move on to the harder part.

History of cryptography

Try the digraph cipher used by British forces in the Boer War and World War I.

Frequently asked questions

What is the Playfair cipher?

+

Playfair is a substitution cipher that encrypts pairs of letters (digraphs) instead of single letters. A keyword fills a 5x5 grid, and each pair is swapped according to where its two letters sit in that grid. It was invented by Charles Wheatstone in 1854 and promoted by Lord Playfair.

How do I decode a Playfair cipher?

+

Enter the keyword, switch to Decode, and paste the ciphertext. By hand you rebuild the 5x5 square from the keyword, then for each pair move left if the letters share a row, up if they share a column, or swap to the other corners of the rectangle. The tool does that for every pair at once.

What happens to J, spaces and punctuation?

+

The 5x5 grid only has room for 25 letters, so J is treated as I. Spaces, digits and punctuation can't be carried by the cipher and are dropped from the output.

Why is there an X in my decoded text?

+

When a pair would be two identical letters, or the message has an odd number of letters, the encoder adds an X filler. Decoding gives those X letters back, so you read past them, for example BALLOON is encoded as BA LX LO ON, and decoding gives BALXLOON back.

Is the Playfair cipher secure?

+

No. It's harder to break than a simple substitution because it works on pairs, but modern frequency analysis and computers crack it easily. Use it for puzzles and learning, never for real secrets.

Can I decode Playfair without the keyword?

+

Not with this tool, which needs the keyword. Without it, solving Playfair means guessing words or using hill-climbing software. If you know a likely word in the message you can often work backwards to the square.

Is my text uploaded anywhere?

+

No. Everything runs in your browser, and nothing you type is sent to a server.

Try the Playfair cipher now

Free, no account needed.