Polybius square cipher — letters to row and column numbers

The Polybius square places the alphabet in a 5×5 grid and writes each letter as its row and column number, such as H = 23; add a keyword to scramble the grid, or switch direction to read the numbers back.

Live demo · real result from this tool
Direction

Result

23 15 31 31 34 / 52 34 42 31 14

Processed on your device — nothing is uploaded.

How to use the Polybius square tool

  1. Choose the Direction: Letters → numbers or Numbers → letters.
  2. Optionally type a Keyword for the square. Leave it empty for the standard grid.
  3. Type into Your text.
  4. Read the Result. Each letter becomes two digits; letters are separated by spaces and words by a slash.

What it does and when to use it

The Greek historian Polybius described a way to signal letters with torches, using a grid of letters and two numbers for each one. The same grid sits at the heart of several later ciphers. On its own it turns text into digits 1 to 5, which suits knocking, flashing a light or hiding a clue in a list of numbers.

It hides nothing from anyone who knows the trick, even with a keyword: every letter always gets the same pair, so frequency analysis breaks it. Use it for puzzles and learning. The bifid cipher and the four-square cipher build on this grid to make stronger classical ciphers, and the tap code is the prison-wall version. For a simpler number code, see A1Z26.

How it works

The standard square, rows down the side and columns across the top:

1 2 3 4 5
1 A B C D E
2 F G H I/J K
3 L M N O P
4 Q R S T U
5 V W X Y Z

Encoding. The text is split into words at spaces. In each word, only letters A to Z are kept, J becomes I, and each letter is written as its row digit then its column digit. Digits and punctuation are dropped, and a word with no letters vanishes.

Keyword square. The keyword’s letters go in first, left to right and top to bottom, skipping repeats, then the unused letters of the alphabet follow. With ZEBRA, the first row is Z E B R A and the second starts C D F G H.

Decoding. The input is split into words at slashes. In each word only the digits 1 to 5 count; they are read in pairs, and an odd number of digits gives a message. The output is in capitals. Everything runs in your browser.

Worked examples

Results from the tool:

Hello world                      →  23 15 31 31 34 / 52 34 42 31 14
Hello          keyword ZEBRA     →  25 12 33 33 41
2433 / 1114    decode            →  IN AD
Jam at 6!                        →  24 11 32 / 11 44

With the keyword, H moves from row 2, column 3 to row 2, column 5. The last line shows J sharing the I cell (24) and the 6 and the exclamation mark disappearing.

Limits and tips

  • Upper and lower case give the same numbers; the decoded text is all capitals.
  • When decoding, digits other than 1 to 5 are skipped without a warning, because the grid has no row or column 0 or 6 to 9. Check the input if a letter seems to be missing.
  • Spaces inside a word are fine when decoding, but a space does not start a new word; only a slash does.

Frequently asked questions

Why is J missing from the square?
A 5×5 grid has only 25 cells, so one letter has to share. This tool puts I and J in the same cell (24), which is the most common choice. When decoding, 24 always comes back as I, so read the word in context.
Do I need a keyword?
No. Leave the keyword box empty for the standard A to Z square. With a keyword, its letters fill the first cells in order, repeats skipped, and the rest of the alphabet follows. The person decoding must use the same keyword.
How do I decode numbers written without spaces?
Paste them as they are. The decoder reads the digits in pairs, so 2433 gives 24 and 33, which is IN. Use a slash between words if you want spaces in the result.
How is this different from tap code?
Tap code uses the same idea, but the grid drops K (sent as C) instead of J, and the numbers are tapped rather than written. Use the tap code translator for that version.

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close