Polybius Square Cipher

Substitute each letter with its row + column digits on a 5×5 grid.

Open tool

Overview

The Polybius square cipher tool replaces each letter of a message with a pair of digits — its row and column on a 5×5 grid. Type plaintext, and the tool emits a stream of digits; paste digits, and it walks the grid backwards to recover the letters.

It is a classical cipher used in cryptogram puzzles, escape rooms, and "tap code" prison communication. Cryptography students and CTF players will recognise it as the building block of the Bifid and Trifid ciphers, and as one of the oldest known ciphers — attributed to the Greek historian Polybius in the 2nd century BC.

How it works

The standard Polybius square is a 5×5 grid filled with the 25 letters of a reduced alphabet (I and J share a cell):

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

Each plaintext letter is replaced by its row digit followed by its column digit. The ciphertext is therefore exactly twice as long as the plaintext (counting only encoded letters). Variants use a keyed alphabet — a 5×5 grid filled with a deduplicated keyword followed by the remaining letters — to make the substitution non-obvious. Non-letters can be passed through unchanged or stripped, depending on the setting.

Examples

Grid:      standard alphabet (I/J merged)
Plaintext: HELLO
Output:    23 15 31 31 34
Grid:      standard
Plaintext: ATTACK AT DAWN
Output:    11 44 44 11 13 25 11 44 14 11 52 33
Ciphertext: 23 15 31 31 34
Grid:       standard
Output:     HELLO

FAQ

Why do I and J share a cell?

A 5×5 grid only fits 25 letters. The most common convention is to merge I and J; some variants merge K and Q or drop Z instead.

What is "tap code"?

A famous Polybius variant used by prisoners of war (e.g. Vietnam-era American POWs). Letters are transmitted as two groups of taps, one for the row and one for the column. It is the same cipher with audible digits.

Is Polybius secure?

No. It is a monoalphabetic substitution dressed up as digit pairs. Letter frequencies survive the encoding, and the cipher falls to standard frequency analysis. It is interesting as a historical primitive and as a building block for stronger fractionating ciphers.

Can I use a 6×6 grid for the full alphabet plus digits?

Yes — many implementations expand to 6×6 to include digits 0–9, removing the I/J collision. This tool focuses on the classic 5×5 form.

Try Polybius Square Cipher

An unhandled error has occurred. Reload ×