Interactive Tool

Polybius Cipher Encoder & Decoder

Enter text to encode or decode. Choose variant, set a keyword key, and see the step-by-step grid mapping.

Configuration
Unique letters from keyword fill the square first, then remaining alphabet letters.
0 characters
Result
Result will appear here after encoding or decoding…
Live Polybius Square
Step-by-Step Encoding
Encode or decode a message to see the character-by-character mapping here…
ℹ Cipher Notes
  • Standard: I and J share cell (2,4). J encodes as I's code.
  • Codes are row number then column number.
  • Spaces and non-alpha characters are preserved in output.
Features

Complete Polybius Cipher Toolkit

Everything you need to explore the world's most famous square cipher.

Three Cipher Variants

Supports the standard 5×5 numeric Polybius Square, the WWI-era ADFGX variant (letters A,D,F,G,X as labels), and ADFGVX — a 6×6 grid that encodes the full alphanumeric charset.

Custom Keyword Keys

Enter a keyword to shuffle the Polybius Square — unique letters from the keyword fill the grid first, then remaining alphabet letters in order. This makes your cipher unique and harder to crack without the key.

Step-by-Step Breakdown

See every character mapped individually — the exact row and column coordinates highlighted live in the grid. Perfect for learning, teaching or manually verifying an encoded message.

Encode & Decode

Full bidirectional cipher — encode plaintext to numeric or letter codes, or paste a code string to decode back to readable text. Works instantly with real-time validation as you type.

Input Validation

Real-time error detection — warns if decode input contains invalid codes for the selected variant, spots malformed pairs, and highlights problematic characters before processing.

100% Client-Side

All encoding and decoding runs entirely in your browser. No text is sent to any server — ideal for encoding private messages, studying historical ciphers or building cipher-based educational exercises.

Process

How the Polybius Cipher Works

Four simple steps from letter to number and back.

Build the Square

Arrange the 25 letters (I/J combined) in a 5×5 grid. With a keyword, unique keyword letters fill the grid first, then the remaining alphabet letters follow in order.

Label Rows & Columns

Number the rows and columns 1–5 (standard), or use ADFGX or ADFGVX letters as labels depending on the variant selected.

Map Each Letter

For each letter in the plaintext, find its cell in the grid. Write the row label followed by the column label as its encoded pair — e.g. 'A' → '11'.

Combine the Pairs

Concatenate all the two-character codes to form the ciphertext. Decode by reversing: split the ciphertext into pairs and look up each pair's row/column to recover the letter.

What is the Polybius Cipher?

The Polybius cipher, invented by the ancient Greek historian Polybius around 150 BC, is one of the world's oldest systematic substitution ciphers. Rather than replacing each letter with another letter, Polybius encoded each character as a pair of coordinates — a row number and a column number — derived from a 5×5 square grid now known as the Polybius Square. This simple but clever system transformed letters into numbers, enabling messages to be transmitted as light or sound signals.

The Polybius Square algorithm arranges 25 letters of the alphabet (combining I and J into a single cell) into a grid labeled 1–5 on both axes. The letter A at row 1, column 1 encodes as 11; B at row 1, column 2 as 12; and so on. To decode, the process reverses: each pair of digits identifies a unique row and column, recovering the original letter.

The Polybius cipher's legacy reaches far beyond ancient Greece. During World War I, German military cryptographers developed the ADFGX cipher (and later ADFGVX), which used the letters A, D, F, G, X as grid labels instead of numbers — chosen because these letters are highly distinct in Morse code, reducing transmission errors. ADFGVX also extended the grid to 6×6 to accommodate digits 0–9 alongside letters.

Modern use cases for the Polybius cipher include cryptography education, CTF (Capture The Flag) competition puzzles, historical cipher studies, escape room design and steganographic art. Adding a keyword dramatically increases complexity — the keyword letters fill the grid first in unique-letter order, scrambling standard positions and making the cipher resistant to simple frequency analysis.

Best practices: always use a secret keyword key when encoding sensitive content; for real security combine Polybius with a transposition cipher (as in ADFGVX); and use this tool purely for educational exploration — Polybius is a classical cipher not suitable for modern cryptographic security.

FAQ

Frequently Asked Questions

Everything about the Polybius cipher, variants and use cases.

The Polybius cipher is an ancient Greek substitution cipher that encodes each letter as a pair of row and column numbers from a 5×5 grid (the Polybius Square). Invented around 150 BC by historian Polybius, it was originally used to send signal-fire messages. I and J share one grid cell since the Latin alphabet has 26 letters but the grid has only 25 cells.
Find each letter in the 5×5 grid. Write the row number first, then the column number. For example in a standard grid: A(row 1, col 1) → 11, B(row 1, col 2) → 12, H(row 2, col 3) → 23. String the pairs together to form the ciphertext. Spaces are typically omitted or replaced to make the message harder to read.
ADFGX is a German military field cipher developed during World War I, introduced in March 1918. It uses the letters A, D, F, G, X as row and column labels in a 5×5 Polybius Square (these letters are very distinct in Morse code). ADFGVX extended this to a 6×6 grid adding V, accommodating the full alphabet plus digits 0-9.
Without a keyword, letters fill the Polybius Square in standard alphabetical order. With a keyword, the unique letters of the keyword fill the grid first (in the order they appear), then the remaining letters of the alphabet fill remaining cells. This scrambles the grid positions, making the encoding unique to that keyword and resistant to simple frequency analysis.
The Polybius cipher is a classical cipher, not secure by modern standards. Without a keyword, frequency analysis of the two-character codes can quickly recover the plaintext. Even with a keyword, sufficiently long ciphertext can be broken. It should only be used for educational, recreational and historical purposes — never for protecting sensitive data.
Explore More Tools

Discover More Free Tools

Explore our full suite of crypto tools, AI utilities and developer resources — all free, no sign-up required.

⚠ Disclaimer: "ADFGX" and "ADFGVX" are designations for historical WWI German military ciphers. "Polybius" refers to the ancient Greek historian. This tool is an independent educational implementation not affiliated with any government, military or standards organisation. The Polybius cipher is a classical cipher unsuitable for modern security. Do not use this tool to protect sensitive or confidential data. See our Privacy Policy.