Home › Ciphers › Polybius Square
Polybius Square
Every system in the fractionation family stands on a Greek historian's signalling grid. Polybius, writing in the second century BC, described how letters could be sent as pairs of numbers — the row and the column of a 5×5 square — originally so that fire signals could spell messages across distances: two groups of torches, held up in counts. On this page the square is the product, not a component: encode letters to coordinates, decode coordinates back, key the square if you wish, and see the exact board every conversion uses. Tap code, Bifid, ADFGX and the Nihilist cipher are all this grid wearing different machinery.
The Polybius square is a 5×5 grid holding the alphabet with J merged into I. A letter's code is its row number followed by its column number — H is 23, E is 15 — so any text becomes pairs of digits 1–5. In its classic form it is a code, not a cipher: the table is public and there is no key.
From Polybius, The Histories, Book 10 (2nd century BC). The root of Bifid, Trifid, ADFGX, the Nihilist cipher and tap code.
Encode or decode — the square is the tool
Everything runs in your browser — nothing is uploaded.
A letter is two small numbers
The classic square writes the alphabet in order into five rows, with J merged into I to fit 25 cells: ABCDE / FGHIK / LMNOP / QRSTU / VWXYZ. A letter's code is its row number followed by its column number — H is 23 (row 2, column 3), E is 15, L is 31 — so HELLO becomes 23 15 31 31 34. Decoding reads the pairs back through the same square. Three output formats are offered because history used all of them: space-separated pairs (the readable default), joined digits (how the numbers travel in a continuous stream — still unambiguous, since every code is exactly two digits), and dash-separated.
Keying the square — keyword letters first, then the rest of the alphabet — moves every letter's coordinates and turns the code into a cipher with a secret; leave the keyword blank for the classic board. Try it: key the square with ZEBRAS and HELLO WORLD becomes 31 12 34 34 42 53 42 14 34 23 — every pair changed although the grid's shape did not. That single experiment is the difference between a code (public table, no secret) and a cipher (same table, keyed), which is why this modest page sits at the root of half the tools on this site. The one loss the square can never repay: J has no cell, so a decoded I may have been a J, and context, as always in this family, has the last word.
Torches on a hillside, 2nd century BC
Polybius of Megalopolis (c. 200 – c. 118 BC), the Greek historian of Rome's rise, describes the square in Book 10 of The Histories as the refinement of an older fire-signalling problem. Earlier beacon systems could only send a handful of prearranged messages — the fleet has arrived — because each signal had to be agreed in advance. Polybius's improvement, building on work he credits to the tacticians Aeneas and to Cleoxenus and Democleitus, was to make the signal compositional: divide the alphabet into five groups of five, and spell any message at all with two banks of torches, the left bank raised to show the group, the right bank the letter within it. It is, arguably, the first digital encoding of text — a letter as two small numbers, two thousand years before the telegraph.
The grid then had a long second life as a component. Delastelle, systematising classical ciphers in 1902, saw that the coordinate pairs could be split and recombined — that is Bifid and Trifid. Russian revolutionaries of the late 19th century used a keyed version with the coordinates added to a running key — the Nihilist cipher — and tapped the plain square through prison walls, the ancestor of the tap code prisoners of war made famous in Vietnam. In 1918 the German army labelled the grid's coordinates A, D, F, G, X and built ADFGX, its best field cipher of the First World War, on top. The square itself never changed; everything since has been machinery around it.
The classic board, printed
| 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 |
Read it as coordinates: the row number comes first, the column second, so 42 is row 4 (QRSTU), column 2 — R. The tool redraws this board live for any keyword; keyed squares keep the shape and shuffle the contents.
HELLO WORLD, letter by letter
Example 1 — the classic square
On the classic square: H is row 2, column 3 → 23. E is row 1, column 5 → 15. L is row 3, column 1 → 31, twice. O is row 3, column 4 → 34. W is row 5, column 2 → 52. R is row 4, column 2 → 42. D is row 1, column 4 → 14. Every letter accounted for, nothing up the sleeve — that transparency is the point of a code.
Example 2 — the same text, the square keyed
The ZEBRAS square reads ZEBRA / SCDFG / HIKLM / NOPQT / UVWXY. Now H sits at row 3, column 1 → 31, and W drops to row 5, column 3 → 53. Same grid, same rule, different contents — and a reader without the keyword faces 25! possible boards instead of one public one. Weak as ciphers go, but it is the exact step from code to cipher, and every keyed-square system on this site takes it.
Nothing to break — and that is the lesson
The classic square protects nothing and was never meant to: Polybius built it to transmit, not to conceal, and anyone with the public table reads the numbers. The keyed square is only cosmetically stronger — the coordinate stream still carries letter frequency in pairs (31 will be common exactly when L is), so a keyed Polybius falls to the same frequency analysis as any substitution, with the pairs merely spelling the letters in numbers. What the square resists is not analysis but channel failure: two small counts survive torches, taps, knocks and flashes that would garble richer signals. Its descendants earn their security elsewhere — Bifid by splitting the pairs apart, ADFGX by transposing the stream, the Nihilist by adding a key — each fixing the plain square's openness with a different machine.
- Security status: none, by design — a transmission code. Keyed, it is a substitution in numbers and falls like one.
- What gives it away: digits only 1–5, in pairs; double letters show as doubled pairs (31 31).
- The joined stream's weakness: lose one digit and every pair after it shifts — the decoder refuses the out-of-range pair rather than reading on into nonsense.
One grid, many machines
| Relative | How it differs | Solve it with |
|---|---|---|
| Tap code | The same square transmitted as knocks — row, pause, column; the prisoner's version | The Identifier routes tap transcripts |
| Bifid | Splits each letter's pair apart and recombines halves across a block — fractionation | The Bifid page |
| Trifid | The same fractionation in three dimensions: a 3×3×3 cube, 27 symbols | The Trifid page |
| ADFGX | Labels the coordinates with letters and transposes the stream by keyword | The ADFGX page |
| Nihilist cipher | Adds a running key's coordinates to the letter's, pair by pair | The Nihilist page |
From torches to taps
The square's cultural footprint is out of all proportion to its simplicity. It is the first thing many puzzle solvers ever encode by hand — a grid in a notebook, a message in numbers under it — and it appears wherever a story needs communication under constraint: prisoners tapping through walls in accounts of the Vietnam War (where the tap code's 5×5 grid, K standing for C's cell in some versions, carried whole conversations), resistance couriers, scout signalling exercises. Its deeper legacy is conceptual: the idea that a letter is two numbers is the seed of every coordinate, matrix and fractionation system in classical cryptography, and a fair ancestor of the character encodings computers use today. When you encode here you are using the family's root in its original form — worth doing once by hand, torch-counting and all, before the machinery pages bury it.
Read the board
Practice 1 — encode ATTACK on the classic square
Watch for the doubled pair where the double letter falls.
Reveal the answer
11 44 44 11 13 25 — the TT shows as 44 44.
Practice 2 — decode 13 34 14 15 on the classic square
Row first, column second, four pairs.
Reveal the answer
CODE.
Frequently asked questions
Is the Polybius square a cipher or a code?
In its classic form, a code: the table is public and there is no key — anyone with the square reads the numbers. Key the square with a secret keyword and it becomes a (weak) cipher, because the table itself is now the secret. The distinction is this site's standing test — no key, no cipher — and the square teaches it better than any definition.
Why is there no J?
Twenty-six letters, twenty-five cells. The classical resolution folds J into I — the same merge Playfair and Bifid use — because I and J were one letter for most of the square's history anyway. Encode a J and you get I's coordinates (24); decode a 24 and you get I, with the J left for your reader's judgement.
Does the joined format lose information?
No, and it is worth seeing why: every coordinate is exactly two digits, each between 1 and 5, so a joined stream re-splits mechanically into pairs. The decoder accepts spaces, dashes or nothing between pairs. What a joined stream cannot survive is a lost digit — the pairing then shifts for everything after it, which the decoder reports as an out-of-range pair rather than decoding on into nonsense.
Did Polybius use the Latin alphabet?
No — his square held the Greek alphabet, and his subject was signalling, not secrecy. The 5×5 Latin form on this page is the shape later centuries standardised as his system travelled into European cipher literature; the mechanism — a letter as a row and a column — is his.
What is the square used for in real systems?
Signalling first (torches, then taps), then as a component: it is the fractionation grid of Bifid and ADFGX, the addition frame of the Nihilist cipher, and the ancestor of the straddling checkerboard. As a standalone secrecy system it protects nothing — and was never meant to.