Skip to content
D DocNectar

Free Four-Square Cipher Encoder and Decoder

Encrypt or decrypt text with the four-square cipher, using two keyword grids and two plain grids to substitute letter pairs.

100% Free No Signup Works on all devices

Built and fact-checked by the DocNectar team — see our editorial standards

Thanks for rating!

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.

  1. Enter mode.
  2. Enter text.
  3. Enter keyword 1.
  4. Enter keyword 2.
  5. 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.

Frequently asked questions

Yes, with no signup and no limit on how many conversions you run.
Playfair uses a single keyed grid and a same-row/same-column/rectangle rule. Four-square uses two separate keyed grids plus two plain grids, and always applies a simpler rectangle-style substitution — no special same-row or same-column cases.
No — like Playfair, it's vulnerable to digraph frequency analysis with enough ciphertext. It's used for education and puzzles today.
They can be the same or different — using two different keywords is more common and gives a larger effective key space.

Get new calculators and guides in your inbox

No spam — just new tools like Four-Square Cipher Tool and practical guides.

Favorites