Cabinet Noir>Learn / ADFGVX cipher

Not sure which cipher? Identify it
The German WWI field cipher that split every letter into two of six letters and then shuffled the result — until Georges Painvin broke it.
Typefractionation + transposition cipher
Breaking ithard to break by hand
Era1918 (World War I)
NameFritz Nebel, German army signal corps
Modesencrypt · decrypt · cryptoanalysis

Learn

ADFGVX cipher

How the ADFGVX cipher works

The idea in one sentence

ADFGVX turns every letter (and digit) of the Plaintext into a pair of coordinates from the six letters A D F G V X, and then scrambles the resulting stream with a column shuffle — so one plaintext letter is first split in two, and each half travels separately. Ciphers that cut letters into pieces like this are called Fractionation ciphers.

The recipe

  1. Build a 6×6 Polybius square filled with a mixed Alphabet: the square Key letters first (duplicates dropped), then the rest of the alphabet, then the digits 0–9. Every cell holds one character.

  2. Replace every plaintext character with the two coordinates of its cell — the row letter and the column letter. A message of N letters becomes a stream of 2N letters from the set A D F G V X.

  3. Write the fractionated stream into a grid, row by row, as wide as the transposition key. If the last row is short, the grid is padded to a full rectangle.

  4. Read the grid out column by column, in alphabetical order of the transposition key letters. That column-by-column reading is the Transposition — the final ciphertext.

A worked example

Step 1 of 12
Plaintext letter
Square coordinates
Fractionated so far
A
AX
AX

Read the first rows: A sits in the cell at row A, column A of the square, so it becomes AA; T lands at row A, column G and becomes AG. The third column shows the fractionated stream growing — the stream that the transposition will later shuffle.

Decryption runs backwards

Given the keys, decryption is mechanical:

  1. Split the ciphertext back into its columns (equal chunks, since the grid was a full rectangle) and lay them back into the grid in key-letter order.

  2. Read the grid row by row — the fractionated stream returns.

  3. Take the coordinates two at a time and look each pair up in the square: the cell is the plaintext character.

The tool does all three steps when you press Decrypt with both keys filled in.

Two variants, one idea

The German army first fielded the 5×5 ADFGX version (letters only, I and J sharing a cell), and within weeks added a sixth row for the digits — ADFGVX. The tool supports both: switch variants above the key fields and the square, the fractionation alphabet and the allowed characters change with it.

Try it in the tool

ADFGVX step by step

Before you start

Open the tool at the ADFGVX cipher. Two key fields sit next to the variant selector: the square Key and the transposition key. This guide walks through a full encryption with the default example keys — NIGHT for the square and GERMAN for the transposition.

Step 1 — watch the square work

Type a short message, for example ATTACK AT 9 AM, and watch the output: it contains only the letters A D F G V X — twice as many characters as your message. Each plaintext character has been replaced by its row and column in the Polybius square. Change one square key letter and every coordinate changes: the square is the Substitution half of the cipher.

Step 2 — watch the shuffle work

Now change only the transposition key. The output keeps the same character counts but the letters jump around — the fractionated stream has been cut into columns and read back in key order. This is the Transposition half. Notice what neither half achieves alone: the substitution flattens nothing by itself, and the transposition carries no letter statistics of its own — the strength comes from stacking them.

Step 3 — decrypt in the tool

Switch to Decrypt, paste the ciphertext and use the same keys. The tool rebuilds the grid, reads it back row by row and looks the coordinate pairs up in the square. Trailing pad characters (the grid padding) may add a stray letter or two at the end of short messages — that is the rectangle being completed, not a bug.

Step 4 — try the ADFGX variant

Switch the variant to ADFGX: the square loses its sixth row (no digits, and J folds into I), and non-letters disappear from the output. The workflow is otherwise identical.

Step 5 — hand the keys to a friend

Full ciphertext, both keys, the variant — that is all a receiver of 1918 needed. Try the practice challenges to see what an attacker without the keys can do.

Breaking the ADFGVX cipher

ADFGVX was designed to resist exactly the two attacks that had killed earlier field ciphers: Frequency analysis (killed by the Fractionation) and pattern-based attacks (killed by the Transposition). It fell anyway — to one of the most impressive cryptanalyses of the First World War. The demo challenge opens the tool's guided cracker on a real ciphertext.

Why one attack is not enough

With the fractionation alone, the ciphertext letters A D F G V X have no useful frequencies of their own: every letter of the plaintext is smeared across two of them. With the transposition alone, the letters of the ciphertext are real fractionated coordinates, but shuffled — their single-letter frequencies are flat too. The defence is the stacking, and the attack has to unstack it in the right order: first undo the shuffle, then solve what is left.

Attack 1 — reassembling the columns

Undoing the Transposition means learning which chunks of the ciphertext were neighbouring columns of the grid. The tell-tale sign: when two chunks really were neighbours, zipping them together pairs every row-coordinate with the matching column-coordinate of the same plaintext letter — the resulting two-letter "symbols" are real letters, with skewed, language-like frequencies. A chi-square independence test on the coordinate pairs measures exactly that tie, and the tool uses it both to rank candidate key lengths and to suggest which columns belong together. Treat the suggestions as hints: on short messages a wrong arrangement can look convincing, and the real test is whether the next stage produces readable text.

Attack 2 — the square as a substitution puzzle

Once the columns sit in the right slots, the coordinate pairs are the letters of an ordinary monoalphabetic Substitution over 25 or 36 symbols. The old machinery applies: the most frequent symbols are the most frequent letters, Crib words confirm guesses, and each confirmed symbol pins a cell of the square and constrains its row and column neighbours. The tool's guided cracker walks this stage with a frequency chart, letter suggestions and a live preview.

The historical shortcut: traffic volume

Georges Painvin's breakthrough in the spring of 1918 came from quantity: dozens of messages enciphered with the same daily key, compared column by column, length against length. Identical long messages on the same key lined up and betrayed the column order in days. A single short message gave him almost nothing — which is why the German radio discipline (or lack of it) decided the battle more than the cipher did.

The verdict

Broken traffic helped stop the German spring offensive of 1918. The cipher itself was sound for its day; the procedures around it were not. ADFGVX remains the textbook case of fractionation plus transposition — and of how key reuse defeats even good designs.

Glossary

Plaintext — The original readable message before encryption.
Ciphertext — The scrambled message produced by encryption.
Key — The secret that controls how the text is scrambled.
Alphabet — The set of letters the cipher works with.
Polybius square — A grid that turns each character into two coordinates: the row and the column of its cell.
Fractionation — Splitting each plaintext letter into several smaller units (here: two coordinates) before the next cipher layer.
Transposition — Changing the order of symbols without changing the symbols themselves.
Frequency analysis — Studying how often letters appear; comparing the counts with the language reveals the plaintext.
Crib — A word you guess is in the plaintext; comparing it with the ciphertext reveals key letters.