ADFGVX Cipher

WWI German field cipher combining a Polybius substitution with a columnar transposition.

Ad placeholder (leaderboard)

The ADFGVX cipher was a German army field cipher introduced in 1918, near the end of the First World War. It is a fractionating cipher: it first replaces every character with a pair of coordinate letters drawn from the set A, D, F, G, V, X, then thoroughly mixes those pairs with a keyword columnar transposition. Combining substitution and transposition in this way was unusually strong for a hand cipher and frustrated Allied codebreakers for months.

How it works

Encryption happens in two distinct stages.

Stage 1 — Polybius substitution. A 6×6 grid is filled with a 36-character key (the 26 letters plus the 10 digits). The rows and columns are each labelled with the letters A, D, F, G, V, X. Every plaintext character is replaced by the row label followed by the column label of the cell it occupies, so each character becomes exactly two ADFGVX letters.

Stage 2 — columnar transposition. The resulting stream of letter pairs is written left to right into a grid whose width equals the length of the transposition keyword. The columns are then read out in the order given by sorting the keyword’s letters alphabetically. This step separates the two halves of each substituted character and spreads them across the whole message, which is what gives ADFGVX its strength.

Decryption reverses the process: rebuild the transposition grid to recover the ADFGVX stream, then look each coordinate pair back up in the square.

Worked example

With the standard square keyed A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 0 1 2 3 4 5 6 7 8 9 and transposition keyword GERMAN, the plaintext ATTACK AT DAWN is first turned into a string of ADFGVX coordinate pairs, then those pairs are columnar-transposed under GERMAN. The output is a block of ADFGVX letters that reveals nothing about letter frequencies in the original message.

Notes and tips

Keep the substitution square and the transposition keyword secret and identical on both ends. Punctuation and spaces cannot be represented by the square, so they are dropped before encryption — write numbers out or keep them in the digit cells. Everything is computed locally in your browser; no message is ever sent to a server.

Ad placeholder (rectangle)