Four-Square Cipher Encoder Decoder
Encrypt and decrypt text with the four-square cipher: two keywords, four 5x5 squares, and pairs of letters.
By Jack Shi · Updated October 8, 2026
- Four-square encrypts pairs of letters using four 5x5 squares: two plain ones and two mixed with keywords.
- You need both keywords, in the same order, and the same alphabet choice, to decrypt.
- A 5x5 square cannot hold 26 letters, so choose I and J share a cell or Q omitted. The published example uses Q omitted.
- Only letters are kept; spaces, punctuation and digits are removed, and an odd last letter gets an X.
- It is historical and educational, not secure modern encryption.
The four-square cipher is a manual symmetric cipher invented by the French cryptographer Félix Delastelle. It arranges four 5x5 squares in a larger square. The top-left and bottom-right squares hold the plain alphabet. The top-right and bottom-left squares are mixed: each starts with a keyword, then continues with the remaining letters in order, skipping repeats.
To encrypt, split the text into pairs and, for each pair:
- Find the first letter in the top-left square and the second letter in the bottom-right square.
- The first ciphertext letter is in the top-right square, in the row of the first letter and the column of the second letter.
- The second ciphertext letter is in the bottom-left square, in the row of the second letter and the column of the first letter.
Decryption runs the same rectangle in reverse, starting from the two keyed squares.
This is the example on the Wikipedia four-square cipher page, using the Q-omitted alphabet. The steps are produced by the same functions as the tool above, so what you see is what the tool returns when you pick “Q omitted”.
Step 1: build the four squares
EXAMPLE builds the top-right square and KEYWORD builds the bottom-left square. The two plain squares hold A to Z without Q.
Top-left (plain)
| A | B | C | D | E |
| F | G | H | I | J |
| K | L | M | N | O |
| P | R | S | T | U |
| V | W | X | Y | Z |
Top-right (EXAMPLE)
| E | X | A | M | P |
| L | B | C | D | F |
| G | H | I | J | K |
| N | O | R | S | T |
| U | V | W | Y | Z |
Bottom-left (KEYWORD)
| K | E | Y | W | O |
| R | D | A | B | C |
| F | G | H | I | J |
| L | M | N | P | S |
| T | U | V | X | Z |
Bottom-right (plain)
| A | B | C | D | E |
| F | G | H | I | J |
| K | L | M | N | O |
| P | R | S | T | U |
| V | W | X | Y | Z |
Step 2: split into pairs
Spaces are removed and the 18 letters are split into 9 pairs: HE LP ME OB IW AN KE NO BI.
Step 3: look up each pair
Rows and columns are counted from 1.
| Pair | First letter (top-left) | Second letter (bottom-right) | Result |
|---|---|---|---|
| HE | H: row 2, column 3 | E: row 1, column 5 | FY |
| LP | L: row 3, column 2 | P: row 4, column 1 | GM |
| ME | M: row 3, column 3 | E: row 1, column 5 | KY |
| OB | O: row 3, column 5 | B: row 1, column 2 | HO |
| IW | I: row 2, column 4 | W: row 5, column 2 | BX |
| AN | A: row 1, column 1 | N: row 3, column 4 | MF |
| KE | K: row 3, column 1 | E: row 1, column 5 | KK |
| NO | N: row 3, column 4 | O: row 3, column 5 | KI |
| BI | B: row 1, column 2 | I: row 2, column 4 | MD |
Step 4: join the results
The ciphertext is FYGMK YHOBX MFKKK IMD, which matches the published result.
A 5x5 square holds 25 letters, so one of the 26 has to go. This tool offers the two usual ways to handle it:
- I and J share a cell (default): J is written as I, so a decrypted J comes back as I.
- Q omitted: I and J keep separate cells, and any Q in the text is dropped.
Both people must use the same choice and the same keywords. If decryption gives nonsense, an alphabet mismatch is the first thing to check, because the squares look almost the same but shift letters between cells.
Each result below is produced by the same code as the tool. Boundary cases and pitfalls are included on purpose.
Published example: help me obi wan kenobi
Encrypt HELP ME OBI WAN KENOBI with keywords EXAMPLE and KEYWORD, Q omitted:
FYGMK YHOBX MFKKK IMD
This is the worked example on the Wikipedia four-square cipher page. It uses the Q-omitted alphabet, so choose "Q omitted" in the tool to reproduce it.
Typical: a short message with two keywords
Encrypt MEET AT NOON with keywords SECRET and MESSAGE, I and J share a cell:
MERUR PLLKN
Twelve letters make six digraphs, so the result is twelve letters shown in groups of five.
Typical: decrypting with the same keywords
Decrypt MERUR PLLKN with keywords SECRET and MESSAGE, I and J share a cell:
MEETATNOON
Decryption reverses the rectangle lookup and returns one run of capital letters without spaces.
Boundary: an odd number of letters
Encrypt HELLO with keywords EXAMPLE and KEYWORD, I and J share a cell:
FYGFI X
HELLO has five letters, so the tool appends an X to complete the last pair. The X is still there after decryption.
Limit: J becomes I in the default alphabet
Encrypt JUMP JETS with keywords EXAMPLE and KEYWORD, I and J share a cell:
FQNGF WRQ
With I and J sharing one cell, decrypting this ciphertext returns IUMPIETS. The reader has to restore the J from context.
Limit: Q is dropped in the Q-omitted alphabet
Encrypt QUIZ TIME with keywords EXAMPLE and KEYWORD, Q omitted:
SCYSC IAZ
The Q has no cell, so it is removed before encryption; the remaining seven letters get an X to make a full last pair.
Pitfall: keywords in the wrong order
Encrypt MEET AT NOON with keywords MESSAGE and SECRET, I and J share a cell:
OEAUA NNKLL
The same text and the same two keywords in the opposite order give a different ciphertext. Decrypting with the order swapped does not recover the message.
Pitfall: punctuation and digits are dropped
Encrypt Hello, World! 123 with keywords EXAMPLE and KEYWORD, I and J share a cell:
FYGFH XHQKK
Only letters are encrypted, so the comma, exclamation mark and digits are removed and cannot come back.
Félix Delastelle (2 January 1840 to 2 April 1902) was a French cryptographer. His book Traité Élémentaire de Cryptographie was completed in May 1901 and published by Gauthier-Villars of Paris after his death (source: Wikipedia, Félix Delastelle). Wikipedia does not state a separate invention date for the four-square cipher, so none is given here.
Because it encrypts pairs, there are 676 possible digraphs instead of 26 letters, which resists simple letter-frequency analysis better than a monoalphabetic cipher. It can still be broken when there is enough ciphertext, so use it for learning, puzzles and clues, not for secrets.
What is the four-square cipher?
The four-square cipher is a manual symmetric cipher invented by the French cryptographer Felix Delastelle. It arranges four 5x5 squares in a larger square and encrypts text two letters at a time. The top-left and bottom-right squares hold the plain alphabet, and the top-right and bottom-left squares are mixed with keywords.
How do I encrypt a pair of letters?
Split the text into pairs. Find the first letter in the top-left square and the second letter in the bottom-right square. The first ciphertext letter is in the top-right square, in the row of the first letter and the column of the second letter. The second ciphertext letter is in the bottom-left square, in the row of the second letter and the column of the first letter.
Which keyword goes in which square?
In this tool, keyword 1 builds the top-right square and keyword 2 builds the bottom-left square. Both must be entered in the same order to decrypt. Swapping them gives a different ciphertext.
Why can I choose between "I and J share a cell" and "Q omitted"?
A 5x5 square holds 25 letters, so one of the 26 has to be left out. The default merges I and J, so J is written as I. The Q-omitted option keeps I and J apart and drops Q. The Wikipedia worked example uses the Q-omitted alphabet, so select it to reproduce that example. Both parties must use the same choice.
Why did my spaces, punctuation and digits disappear?
Only the letters A to Z are placed in the squares. Spaces, punctuation and digits are removed before encryption, and lower case becomes upper case, so decryption returns one run of capital letters.
Why is there an X at the end of my decrypted text?
Encryption works on pairs. If the text has an odd number of letters, the tool appends an X so the last pair is complete. That X is part of the ciphertext and appears again when you decrypt.
Is the four-square cipher secure?
No, not for modern use. Encrypting pairs of letters gives 676 possible digraphs instead of 26 letters, which resists simple letter-frequency analysis better than a monoalphabetic cipher. It can still be broken when there is enough ciphertext, so treat it as a historical and educational cipher.
Related methods: the Two-Square cipher, the Playfair cipher, the Polybius square and the Bifid cipher.