ADFGX Cipher
NewEncrypt and decrypt text with the WWI German ADFGX field cipher, combining a keyed Polybius square with a columnar transposition.
ADFGX was a field cipher used by the German Army in World War I. A keyword mixes the alphabet (I and J share a cell) into a 5x5 grid labeled A/D/F/G/X on both axes — those five letters were chosen because they sound very different from each other in Morse code, reducing transmission errors. Each plaintext letter becomes a 2-letter row/column pair, and the resulting stream of pairs is then scrambled with a columnar transposition driven by a second keyword. Decryption reverses both steps exactly.
Frequently Asked Questions
Why only the letters A, D, F, G, and X in the ciphertext?
Those five letters were deliberately chosen by the cipher's German inventors because their Morse code representations are very different from one another, which reduced the chance of a radio operator mishearing or mistransmitting a character.
What are the two keywords for, and are they the same thing?
No — the Polybius square keyword mixes the 25-letter alphabet (I and J share a cell) into the 5x5 grid used for the first fractionation step, while the separate transposition keyword determines the column order used to scramble the fractionated letters afterward. Historically these were two independent secrets.
Why does the ciphertext length not exactly match the plaintext length?
Each plaintext letter expands into two ciphertext letters (its row and column label), and the columnar transposition step may pad the result with extra X characters to fill out the last row completely — both are normal and expected.
Is this the same as ADFGVX?
No — ADFGVX is a later 1918 extension that added a sixth letter (V) to support a 6x6 grid covering the full 26-letter alphabet (without combining I/J) plus digits 0-9. This tool implements the original 1918 ADFGX cipher with its 5x5, 25-character grid.
Why was this cipher considered historically significant?
The German Army believed ADFGX (and later ADFGVX) was unbreakable when introduced during World War I, but French cryptanalyst Georges Painvin famously broke it, providing intelligence that is credited with helping halt a major German offensive in 1918.