Polybius Square Cipher
Encode text to coordinate pairs using the classic 5x5 Polybius grid (I/J combined).
| 1 | 2 | 3 | 4 | 5 |
|---|
How to Use the Polybius Square Tool
- Choose Encode or Decode — select your direction using the option chips above.
- Optional: set a keyword — click Custom Key to enter a keyword that shuffles the grid order.
- Type or paste your text — plaintext for encoding, number pairs for decoding.
- Read the output — encoded pairs or decoded text appears on the right.
- Copy the result — use the Copy button to copy to clipboard.
About the Polybius Square
The Polybius square is one of the oldest known ciphers, developed by the ancient Greek historian and soldier Polybius (c. 200–118 BC). Originally designed to allow messages to be signaled with torches (by holding up groups of torches to indicate row and column numbers), it later became the basis for many more advanced cipher techniques. The square's 5x5 grid holds 25 of the 26 English letters, with I and J traditionally sharing one cell.
Standard vs. Keyed Polybius Square
In the standard Polybius square, the alphabet is placed in the grid left-to-right, top-to-bottom in order: ABCDE in row 1, FGHIJ in row 2, and so on. In a keyed version, a keyword is written first (with duplicate letters removed), followed by the remaining unused letters of the alphabet. This means the same plaintext will produce completely different ciphertext depending on the keyword, greatly increasing the cipher's security.
Encoding Rules
Each letter maps to two digits: the first is its row number (1–5) and the second is its column number (1–5). Since I and J share cell (2,4) = "24", encoding always treats J as I, and decoding 24 gives I. Spaces and punctuation in the plaintext are typically skipped during encoding. In the output, pairs are separated by spaces for readability.
Historical Uses and Derivatives
The Polybius square is the foundation for several more advanced cipher systems. The ADFGVX cipher used in WWI replaced the digits 1–5 with the letters A, D, F, G, X (and V for the 6x6 version) and then added a columnar transposition step. The Tap Code, used by American POWs in Vietnam, is a direct application of the Polybius square: K is merged with C, and each letter is communicated as two sequences of taps representing the row and column. The Bifid cipher extends the Polybius square into a more complex fractionating scheme.
Security Analysis
The standard Polybius square offers no real security — it is a simple monoalphabetic substitution where each letter is replaced by a fixed two-digit pair. Frequency analysis can crack it easily. A keyed Polybius square is slightly harder but still vulnerable to frequency analysis since it remains a monoalphabetic substitution. The value of the Polybius square lies not in standalone security but as a building block for more sophisticated ciphers that combine substitution with transposition.