Join the Official Discord

Polybius square cipher

Letters become row-and-column numbers. Add a keyword to scramble the square.

The square

How the Polybius square works

Write the alphabet into a 5×5 grid. Twenty-six letters don't fit in twenty-five cells, so I and J share. Number the rows and columns 1 to 5. Every letter becomes two digits, its row and then its column: H is in row 2, column 3, so it's 23. TREASURE becomes 44 42 15 11 43 45 42 15.

The Greek historian Polybius described it around 150 BC for signalling with torches: hold up so many in the left hand for the row, so many in the right for the column. It's the ancestor of a long line of ciphers. Tap code is the same idea knocked on a wall, and Playfair, Bifid and ADFGVX all start from a square like this one.

Keyword squares

Fill the square with a keyword first and the rest of the alphabet after it, and the numbers no longer line up with the plain alphabet. Without the keyword, the code becomes a substitution cipher on pairs of digits. To crack one, turn each number pair into any letter consistently and run the result through the substitution solver.

Spotting one

Only the digits 1 to 5, usually in pairs. No pair goes above 55 and no digit is 0 or above 5. The cipher identifier checks for exactly that.

Questions

How does the Polybius square work?

Write the alphabet into a 5×5 grid, with I and J sharing a cell. Each letter becomes two digits: its row, then its column. H is in row 2, column 3, so it becomes 23.

What does the keyword do?

It fills the square first, like Playfair: the keyword's letters go in, then the rest of the alphabet. Without the keyword, the numbers don't map back to the right letters.

How is it different from tap code?

Tap code is a Polybius square with C and K sharing a cell instead of I and J, and the numbers are knocked rather than written. It has its own tool.

More cipher tools

See all cipher tools →