Polybius and communication codes

Polybius was an Ancient Greek Historian born around 200 BC, but he wasn’t just interested in history. He also perfected a useful communication code that could for sending messages over long distances. It could also be used as a form of cipher to send secret messages. It was called the Polybius Square.

As he was Ancient Greek he, of course, used the Greek Alphabet. This version uses our Alphabet. His square was just a 5 by 5 grid as below, with rows and columns each labelled with the numbers 1 to 5. The letters of the alphabet are then placed in the grid as shown with I and J pairing up in one square.


Each letter is then encoded using its coordinates – a pair of numbers. He used row then column number. We will use a variation that is consistent with our traditional (x,y) coordinate system, so column number then row. Using this variation P is in position (5,3) so is encoded as 53.  POLYBIUS becomes 53 43 13 45 21 42 54 34.

To work out the original message you use the same square, looking up the letters at the coordinates given in the message.


Polybius invented this coding system as a way of sending messages over long distances using torches. Rather than using different patterns of torches to mean whole messages, with his system any message could be sent. With 5 different torch patterns, one for each of the 5 numbers, you could send messages as sequences of these torch patterns. It could be used, in particular, as an improvement to the Hydraulic Semaphore system invented by Tacticus that Polybius wrote about in the history he wrote of the rise of the Roman republic.

This is an early version of a communication network based on numbers. We use that same basic idea now to send messages as numbers but over computer networks instead of torch ones.


Though Polybius intended his system as a telegraphy system it could also be used as a secret code – a cipher – too. Rather than using torches you could just write the numbers down on paper as a secret message. Now we would find it quite easy to crack, but it would have been as secure as other ciphers of the Greeks and Romans.


Polybius may not have realised this, but, as it only uses 5 numbers, his system could also be the used as the basis of steganography, where the message is hidden in plain sight. For example, with 5 different colours or kinds of stitch, each standing for a different number, messages could be sown in to a rug or quilt.

Ancient Greek Computer Science

Computer Science and History

This work was supported by the Institute of Coding, which is supported by the Office for Students (OfS).

IoC logo on white