Morse Code Translator
  1. Translator
  2. Playfair cipher

Playfair cipher decoder and encoder

Decode a Playfair cipher with its keyword, or encode a message using the same square. Check each pair’s rule and keep possible padding letters for review.

To decode a Playfair cipher, choose Decode, enter the ciphertext and its keyword, then press Convert. This decoder shows the key square and each letter-pair rule. It keeps possible padding letters so you can decide what belongs in the final message.

Decode or encode a Playfair message

Everything runs in your browser; your text and key stay on this device.

Enable JavaScript to use the tool. You can still follow the computed example and key square below.

How do you decode a Playfair cipher with a key?

Start with the example already in the tool. Leave the direction on Decode ciphertext and the key on GALOIS. After conversion, read the result, then open Show pair-by-pair steps. Compare the first input pair with its positions in the square. Editing any field hides the old result until you convert again.

For your own puzzle, paste the complete ciphertext before converting. Spaces between groups are fine: this tool removes them before making pairs. Keep a separate copy of the original clue so you can compare your transcription. Use Copy result for the complete uppercase output. The trace displays the first 60 pairs. Use Clear to empty text and key.

How do you make a Playfair cipher key square?

Write the keyword from left to right, skipping letters already used. Add unused alphabet letters in order, filling a five-by-five square. Merge J into I so the alphabet fits the 25 cells (Northern Kentucky University, page 3).

A five-by-five grid of blank square tiles sits on a desk beside an old brass key.
Illustration: A blank five-by-five key square

The tool accepts a keyword or phrase containing ASCII letters and ASCII whitespace, up to 100 characters. A blank key, a key containing only whitespace, or one with digits, punctuation or accents gets an error. Letter case and accepted whitespace do not change the square. The displayed I cell also represents J; this tool does not offer a separate alphabet that omits Q.

What are the Playfair cipher rules?

Playfair substitutes pairs of letters, called digraphs, so each output depends on both input letters (Northern Kentucky University, page 1).

  1. Same row: encode each letter one cell right; decode one cell left. Wrap at the edge.
  2. Same column: encode one cell down; decode one cell up. Wrap at the edge.
  3. Rectangle: keep each letter’s row and take the other letter’s column. Use this for either direction.

These are the square transformation rules (Northern Kentucky University, pages 4–5). In the tool’s trace, positions start at row 1 and column 1. Read the two positions in input order, then follow the named rule.

What is a worked Playfair cipher example?

Christensen’s classroom example uses the key GALOIS and the message COMSEC means communications security. (Northern Kentucky University, pages 3–5). Every square cell, prepared pair and output below is computed by the same module as the interactive tool.

Playfair key square · I and J share I
Row12345
1GALOI
2SBCDE
3FHKMN
4PQRTU
5VWXYZ

Normalized input: COMSECMEANSCOMMUNICATIONSSECURITY. Prepared pairs: CO MS EC ME AN SC OM MU NI CA TI ON SX SE CU RI TY. Encoded result: DLFDSDNDIHBDDTNTUEBLUOIMCVBSERULYO.

Pair steps · first 17 of 17; positions are (row, column)
PairInputPositionsRuleOutput
1CO(2, 3) / (1, 4)Rectangle: swap columnsDL
2MS(3, 4) / (2, 1)Rectangle: swap columnsFD
3EC(2, 5) / (2, 3)Same row: rightSD
4ME(3, 4) / (2, 5)Rectangle: swap columnsND
5AN(1, 2) / (3, 5)Rectangle: swap columnsIH
6SC(2, 1) / (2, 3)Same row: rightBD
7OM(1, 4) / (3, 4)Same column: downDT
8MU(3, 4) / (4, 5)Rectangle: swap columnsNT
9NI(3, 5) / (1, 5)Same column: downUE
10CA(2, 3) / (1, 2)Rectangle: swap columnsBL
11TI(4, 4) / (1, 5)Rectangle: swap columnsUO
12ON(1, 4) / (3, 5)Rectangle: swap columnsIM
13SX(2, 1) / (5, 3)Rectangle: swap columnsCV
14SE(2, 1) / (2, 5)Same row: rightBS
15CU(2, 3) / (4, 5)Rectangle: swap columnsER
16RI(4, 3) / (1, 5)Rectangle: swap columnsUL
17TY(4, 4) / (5, 4)Same column: downYO

For a second check, use MONARCHY and INSTRUMENTS. Our computed result is GATLMZCLRQXA; decoding returns INSTRUMENTSX, matching the faculty chapter’s example (Adam Mickiewicz University, section 8.3).

Why does Playfair add X, and what happens to J?

Plaintext preparation separates identical letters that would occupy one pair and completes an unpaired final letter. I/J merging loses the distinction between those letters (Adam Mickiewicz University, preparation notes). This tool uses X as filler, with Q when the letter needing a partner is itself X. That Q fallback is this tool’s explicit convention.

Try BALLOON with MONARCHY. The prepared text is BA LX LO ON, and applying the cited rules gives IBSUPMNA (Adam Mickiewicz University, section 8.2). The preparation display lists up to 60 inserted letters and their positions. Repeated letters across separate pairs do not need a filler (Northern Kentucky University, page 4).

Decoding deliberately leaves X and Q alone. Do not delete every X from a result: you could remove a letter in the intended message. Restore word spaces, punctuation and possible J spellings only after reading the whole result in context. A return trip checks the prepared text, rather than recovering every character you originally typed (Adam Mickiewicz University, sections 8.2–8.3).

The message field keeps only ASCII letters (A–Z or a–z), then uppercases them and merges J into I. A letter such as é is discarded rather than changed to E. Digits and punctuation are also discarded. Check the normalized input shown with your result before using it for a clue that relies on numbers or accented names.

Can you decode a Playfair cipher without the key?

This tool requires the key. It does not search for a keyword or score possible plaintexts. The faculty chapter discusses digraph frequency analysis and computational key searches (Adam Mickiewicz University, section 8.4). For this decoder, get the keyword and alphabet convention from the puzzle setter.

If a known key gives nonsense, check for missing letters and confirm the cipher variant. An odd letter count produces an error instead of an invented final letter. An identical-letter ciphertext pair is also rejected. Do not insert X into ciphertext to fix either error: return to the original clue and compare it character by character.

How can you send a Playfair ciphertext in Morse?

For your own puzzle hunt or escape-room clue, try a two-stage exercise: encode OPEN with MONARCHY, then send the computed ciphertext HVGM in Morse. The signals represent the ciphertext letters using the International Morse alphabet (ITU-R M.1677-1, Annex 1). The player below demonstrates that order.

Read HVGM from the Morse signals, then decode with MONARCHY to recover OPEN.

Read the signals with the Morse code alphabet, then paste those letters into this Playfair decoder. To prepare a different signal, put your ciphertext in the Morse code translator. Keep the keyword on a separate clue card if you want the recipient to practice both steps.

See Morse code and ciphers for the distinction between representing letters and concealing a message.

Who invented the Playfair cipher?

Charles Wheatstone devised the cipher for secrecy in telegraphy. It took the name of his friend Lyon Playfair, who demonstrated it in 1854 (Northern Kentucky University, pages 1–2).

For another exercise, compare this pair-based tool with the Caesar cipher translator and Vigenère cipher translator. Use each tool’s worked example before switching to your own text.

Sources

  1. Polygraphic Ciphers, pages 1–5. Chris Christensen, Northern Kentucky University, Fall 2006; checked 20 November 2026.
  2. Chapter 8: The Playfair Cipher (SageMath), sections 8.2–8.4. Bartosz Naskręcki, Adam Mickiewicz University faculty website, checked 20 November 2026.
  3. Recommendation ITU-R M.1677-1, International Morse code. ITU Radiocommunication Sector, October 2009.