Built and fact-checked by the DocNectar team — see our editorial standards
Key Features
Instant Calculation
Get accurate results in real time with our optimized algorithm.
Mobile Friendly
Fully responsive design. Works on all devices & screen sizes.
Privacy Focused
Your data stays on your device. We don't store any inputs.
100% Free
No hidden costs. This tool is completely free forever.
The four-square cipher, also invented in the 1850s, is a digraph substitution cipher like Playfair, but it uses four 5x5 grids and two separate keywords instead of one, making its substitution rule simpler while still resisting basic frequency analysis.
This tool encrypts or decrypts text using a four-square cipher built from two keywords you choose.
How it works
Two plain alphabet squares sit at top-left and bottom-right; the two keyword squares sit at top-right and bottom-left. To encrypt a letter pair, the first letter's row (in the top-left plain square) and the second letter's column (in the bottom-right plain square) pick out the two ciphertext letters from the keyword squares. Decryption reverses this using the keyword squares to find the original letters in the plain squares.
- Enter mode.
- Enter text.
- Enter keyword 1.
- Enter keyword 2.
- Click Calculate to see your results.
Examples
Keywords "EXAMPLE" and "KEYWORD"
"HELLOWORLD" encrypts to a scrambled letter sequence unique to those two keywords — using different keywords produces completely different ciphertext.
Who should use it
- Puzzle and escape-room style word games.
- Teaching multi-grid digraph substitution as a variation on Playfair.
Industry applications
- Cryptography education
- Games and puzzles
Advantages
- Simpler, more uniform substitution rule than Playfair (always the rectangle case).
- Two independent keywords give a larger key space than a single-keyword cipher.
Limitations
- Still breakable with digraph frequency analysis given enough ciphertext.
Common mistakes to avoid
- Swapping the order of the two keywords between encryption and decryption — key 1 and key 2 must stay in the same positions both times.
- Expecting the same row/column special cases as Playfair — four-square always uses the rectangle rule.
Best practices
- Use the four-square cipher for puzzles or teaching digraph substitution with multiple keyed grids.
Tips
- Keep track of which keyword is "key 1" and which is "key 2" — swapping them will produce completely different, incorrect results.