Polybius Square Cipher

This polybius square cipher turns HELLO WORLD into 23 15 31 31 34 / 52 34 42 31 14 on a 5x5 square, and turns the digits back into letters.

Input

0 of 5,000 characters (code points).

Using the plain square.

Square
Direction

Encoded on the 5 by 5 square, no key

Type some text first.

Square

Square for key (none). I and J share one cell.
A11, row 1, column 1B12, row 1, column 2C13, row 1, column 3D14, row 1, column 4E15, row 1, column 5
F21, row 2, column 1G22, row 2, column 2H23, row 2, column 3I/J24, row 2, column 4K25, row 2, column 5
L31, row 3, column 1M32, row 3, column 2N33, row 3, column 3O34, row 3, column 4P35, row 3, column 5
Q41, row 4, column 1R42, row 4, column 2S43, row 4, column 3T44, row 4, column 4U45, row 4, column 5
V51, row 5, column 1W52, row 5, column 2X53, row 5, column 3Y54, row 5, column 4Z55, row 5, column 5

Why use this Polybius Square?

The Grid Is on the Page

The square you are encoding against is drawn next to the output, so you can check any digit pair by eye instead of trusting a black box.

One Variant, Stated

I and J share cell 24 on the 5x5 and nothing else is merged; the 6x6 mode has no merge and adds the ten digits. Both are named on the page.

Keyed Squares and Real Decoding

Type a key to reorder the square, and paste digits with spaces, commas or none at all. The decoder skips anything that is not a digit pair.

What is a Polybius Square?

A Polybius square writes the alphabet into a grid, five columns by five rows, and names each cell by its row and its column. The device is older than the name suggests: the historian Polybius credits Cleoxenus and Democleitus with inventing it and describes developing it himself, and it was first used to send messages by fire signal. Five rows and five columns hold 25 cells, and the Latin alphabet has 26 letters, so two letters share one cell. In the usual Latin form that pair is I and J, and the shared cell is row 2, column 4.

Each letter then becomes two digits, row first and column second, from 11 to 55. BAT is 12 11 44. The cipher is a substitution with digits for symbols, which is why it is easy to break with frequency analysis, and it is still used in puzzles, escape rooms and teaching because the grid makes a cipher you can copy by hand. A key can reorder the square: its letters come first, without repeats, and the rest of the alphabet follows in order. The same 5x5 alphabet sits under the playfair cipher, which encrypts pairs instead of single letters.

Which Variant This Page Uses

  • Square, 5x5ABCDE FGHIK LMNOP QRSTU VWXYZ. Five rows of five, read row 1 to row 5 and left to right.
  • Letter mergeI and J share cell 24, so J encodes as 24 and a decoded 24 is shown as I. Nothing else is merged: K keeps its own cell.
  • Coordinate orderRow first, then column. A is 11, E is 15, Z is 55.
  • Keyed squareType a key and the square is rebuilt: key letters without repeats first, J read as I, then the rest of A to Z without J. With the key QUICKNOTE the rows are QUICK NOTEA BDFGH LMPRS VWXYZ.
  • 6x6 modeA to Z then 0 to 9, no merge, 36 cells. Digits inside the text are encoded too: with the key off, MEET AT 10 is 31 15 15 42 / 11 42 / 54 53.
  • Pass-throughPunctuation and any character the chosen square cannot hold are copied to the output unchanged, spaces stay as the gap between words, and none of them is counted as a letter.
  • LimitsUp to 5000 code points of input and 5000 code points of digits. Over the limit the page refuses the input and says so before doing any work.
  • Saved inNothing is saved. Reloading the page clears the text.
  • Not includedBifid, ADFGVX and other ciphers built on this square, image export and any history of past results.

Common Use Cases

Classroom Ciphers

Give a class a message in digits and let them rebuild the square to read it.

Escape Room Puzzles

Check a two-digit clue against the grid without working it out on paper.

Hand-Copied Messages

Encode a short note into digits that survive being written out by hand.

Keyed Variants

Type the keyword from the puzzle and read the message off the reordered square.

Digit Messages in 6x6

Switch to the 6x6 square when the message itself contains numbers.

Checking Homework

Decode an answer and compare it with the square printed on the worksheet.

Learning Frequency Analysis

Count the most common digit pairs to see why a single substitution is easy to break.

How to Encode and Decode

1

Pick the square

Choose 5x5 with I and J merged, or 6x6 to include digits. On the 5x5 you can type a key for a reordered square.

2

Type your text

Paste the message. The square and the digit pairs update as you type.

3

Press Encode

Each letter becomes a row and a column digit, separated by spaces. HELLO WORLD is 23 15 31 31 34 / 52 34 42 31 14.

4

Press Decode for the way back

Paste digits in any spacing and the letters come back. The page also strips the separators first, so 2315313134 decodes the same as the spaced form.

What You Can Do With the Output

Copy the Digits

One button copies the digit pairs as shown, with a space between pairs and a slash between words.

Keep the Case Out of It

The cipher has no case, so decoded text is upper case; copy it and restore case where it matters.

Check a Keyed Square

The keyed grid is shown, so you can compare it to the one in a puzzle book.

Decode Without Cleanup

Commas, spaces, line breaks and stray letters are ignored, so text copied out of a chat still decodes.

Copy and Compare

Copy the digits, then check them against the square on the page or a puzzle book by eye.

Tips for Polybius Square Work

  • •Agree the merge first If your grid merges a different pair, spell the message with the merged letter replaced before encoding, or the decoder will not agree.
  • •Count in pairs 10 letters become 20 digits. A digit string of odd length is missing a digit, not a letter.
  • •Separators are free Spaces help people read pairs, and the decoder ignores them, so use them.
  • •A key does not add strength The key reorders the alphabet but the cipher still falls to frequency analysis.
  • •Watch the 6x6 digits In 6x6 mode a digit is a character, so a message with numbers is longer, not shorter.
  • •Keep the square with the message A keyed square cannot be rebuilt from the ciphertext alone unless the key is known.

Start With a Message

Type a word above and read its pairs off the square. Everything runs in this browser and nothing you type is sent anywhere.

If you want the pair-based version of the same grid, open the playfair cipher, or try the a1z26 cipher for letter numbers without a grid.

Related tools

Frequently Asked Questions

Can I use a different letter pair instead of I and J?

Not on this page. The 5x5 here always merges I and J, because the square is shared with the playfair cipher, which fixes that pair. Encode the merged letter as the one the grid keeps, or switch to the 6x6 mode where nothing is merged.

Why does my decoded text have no spaces?

A Polybius square has no cell for a space. This page copies spaces through when you encode, so they survive, but if you paste only digits there is nothing to restore them from. Keep the encoded output with its separators to decode reliably.

How long can the message be?

Up to 5000 code points, which is roughly 800 words of English. Past that the page refuses the input with a message instead of cutting it.

Is this the cipher used in escape rooms?

Escape rooms often use the same grid with symbols in place of digits, and some use a keyword to fill it. The idea is identical: two coordinates name one cell. This page keeps the digits so you can check the answer.

Does the key make the cipher secure?

No. A keyed square is still a single substitution, so letter frequency gives it away: in English E, T and A are the most common letters, and the most common digit pairs follow them. Use it for puzzles, not for secrets.