Skip to content

Polybius Square Cipher

Turn each letter into a pair of numbers — its row and column in a 5 × 5 grid — or read coordinates back into text. Mix the square with a keyword if you like, or switch to the tap code that prisoners knocked through cell walls.

Mode
Grid

Mixes the square: the keyword's letters come first, each once, then the rest of the alphabet. J counts as I.

Each letter becomes its row number, then its column number. Letters are separated by a space and words by a slash; punctuation is dropped.

The grid

12345
1ABCDE
2FGHI/JK
3LMNOP
4QRSTU
5VWXYZ

Rows are numbered down the side and columns across the top. Letters in your message are highlighted.

Letter by letter — the first 12 letters

LetterRowColumnCode
L3131
I2424
G2222
H2323
T4444
T4444
H2323
E1515
T4444
O3434
R4242
C1313

How to Use the Polybius Square Cipher

  1. 1. Choose Encode or Decode. Encoding turns letters into coordinates; decoding reads coordinates back into letters.
  2. 2. Choose the grid. The Polybius square puts I and J in one cell. The tap code shares a cell between C and K instead and keeps I and J apart.
  3. 3. Add a keyword if you want one. In the Polybius square a keyword reorders the grid, so the coordinates stop being the standard ones — whoever decodes needs the same keyword.
  4. 4. Read the result and the grid. Letters are separated by spaces and words by a slash. The grid under the tool highlights every letter of your message, and the table spells out the first dozen coordinates.

How the Polybius Square Works

Write the alphabet into a 5 × 5 grid and number the rows and the columns from 1 to 5. Every letter now has an address: its row number followed by its column number. Twenty-five cells can hold 26 letters only if two share, so I and J go together, as they did in Latin. H, in row 2 and column 3, is 23; Z, in the bottom right corner, is 55.

The standard Polybius square: row number first, then column
12345
1ABCDE
2FGHI/JK
3LMNOP
4QRSTU
5VWXYZ

Worked example

The tool's sample, Light the torches, becomes 31 24 22 23 44 / 44 23 15 / 44 34 42 13 23 15 43. L is row 3, column 1; I is row 2, column 4; G is row 2, column 2; and so on, with a slash between words. To decode, read the digits in pairs, row first, and look each pair up. Spacing does not matter, so 3124222344 decodes to LIGHT just the same.

Keyword squares

A keyword changes the order of the letters in the grid: its letters go in first, each only once, followed by the rest of the alphabet. With the keyword ZEBRAS the top row reads Z E B R A, and LIGHT becomes 34 32 25 31 45 instead of 31 24 22 23 44. The method stays the same; only the arrangement is secret.

From Torch Signals to Prison Walls

The square is named after Polybius, the Greek historian of the second century BC. In Book X of his Histories he describes a way of signalling over long distances with torches: the 24 letters of the Greek alphabet are split into five groups, and each letter is sent as two numbers — torches raised on the left for the group and on the right for the letter's place in it. He credits the scheme to Cleoxenus and Democleitus and describes his own improvements.

The same grid came back as the tap code. Because a K can be written as C, the tap-code grid drops K and keeps I and J apart, and each letter is knocked as two groups of taps: the row, a pause, then the column. A tapping alphabet of this kind appears in Arthur Koestler's novel Darkness at Noon (1940), and American prisoners of war in North Vietnam relied on it for years after Air Force Captain Carlyle Harris introduced it in 1965. The tool writes taps as dots, so WATER becomes ..... .. . . .... .... . ..... .... .., one group per letter.

Polybius squares also became parts of stronger ciphers. The German ADFGVX cipher of 1918 turned each letter into a pair of coordinates from a mixed square and then transposed them, and the bifid and Nihilist ciphers combine the coordinates in other ways.

Breaking a Polybius Cipher

On its own the Polybius square is a simple substitution in a numeric disguise. Each letter always becomes the same pair, so in a long message the most common pairs stand for E, T, A and O, and frequency analysis does the rest — with or without a keyword. The coordinates also give themselves away, since only the digits 1 to 5 ever appear, and always in pairs. The square's strength was never secrecy but convenience: it turns any letter into two small numbers that can be signalled with torches, taps, knocks or flashes.

Frequently Asked Questions

What is a Polybius square?
A 5 × 5 grid of the alphabet with numbered rows and columns, used to turn each letter into a pair of digits — its row, then its column. With I and J sharing a cell, A is 11, B is 12 and Z is 55. It is named after the Greek historian Polybius, who described a torch-signalling system built on the idea.
How do you decode a Polybius square cipher?
Split the numbers into pairs and look each one up: the first digit is the row and the second the column, so 23 is row 2, column 3 — H in the standard square. If a keyword was used, build the same keyword square first. The tool reads the pairs for you and ignores spacing.
Why do I and J share a cell?
A 5 × 5 grid has 25 cells and the English alphabet has 26 letters, so two letters must share one. I and J are the usual pair because J began as a variant of I and is easy to restore from context. The tap code solves the same problem by writing K as C instead.
What is the tap code?
A version of the Polybius square for communicating by knocking: tap the row number, pause, then tap the column number. Its grid drops K, which is sent as C, and keeps I and J separate. American prisoners of war in Vietnam used it to talk between cells.
What does a keyword do in a Polybius square?
It rearranges the grid: the keyword's letters fill the first cells, without repeats, and the rest of the alphabet follows. Every letter's coordinates change, so the standard square no longer works for the reader. It does not stop frequency analysis, though, because each letter still always becomes the same pair.
Is the Polybius square secure?
No. It is a substitution cipher with an obvious fingerprint — pairs of digits from 1 to 5 — and its letter frequencies come through intact. It was designed for signalling rather than secrecy, and it only becomes strong when combined with further steps, as in the ADFGVX cipher.

Related Tools

More in Codes & Ciphers

See all Codes & Ciphers