Report Tool or Give Us Suggestions

ADFGX Cipher

Encode and decode messages using the World War I German ADFGX fractionated transposition cipher with an interactive Polybius grid and columnar sorting visualizer.

L ading . . .

What is the ADFGX Cipher?

The ADFGX Cipher is a famous World War I military cipher used by the German Army on the Western Front beginning in March 1918. Invented by a German radio signals officer, Colonel Fritz Nebel, the cipher was designed to provide highly secure field communications during the German spring offensive.

Nebel's cipher combined two traditional cryptographic concepts: **fractionated substitution** (using a Polybius square) and **columnar transposition**. This hybrid strategy made it incredibly resistant to traditional frequency analysis because individual plaintext letters were split into two separate coordinate letters, which were then physically separated across the transmission.

Why the Letters A, D, F, G, and X?

The cipher's name derives from the row and column headers of its Polybius grid: **A**, **D**, **F**, **G**, and **X**. These specific letters were not chosen at random. They were selected because their representation in **Morse code** (dots and dashes) is highly distinct from one another:

  • A: • —
  • D: — • •
  • F: • • — •
  • G: — — •
  • X: — • • —

By using letters with vastly different Morse profiles, operators sending telegraphic signals in noisy field environments were much less likely to make transmission or transcription errors.

The Mathematical Structure of ADFGX

The ADFGX cipher consists of two main algorithmic steps, defined as follows:

Step 1: Fractionated Substitution (Polybius Square)

A $5 \times 5$ grid is constructed using a custom keyword (e.g., "DEUTSCHLAND"). Duplicates are removed and the remaining letters of the alphabet are filled in sequentially. Since the grid has 25 slots and the English alphabet has 26 letters, the letter 'J' is merged into 'I'.

To substitute a message, each letter of the plaintext is replaced by the corresponding row and column headers. For example, if 'H' is located at row **F** and column **A**, it is replaced by **FA**:

$$\text{Plaintext letter } P \to \text{Row } R \text{ + Column } C$$

Step 2: Columnar Transposition

The intermediate fractionated string is written row by row into a second grid whose width matches the length of a second secret keyphrase (the Transposition Key).

Once written, the columns of the transposition grid are sorted **alphabetically** based on their key letters. Finally, the ciphertext is read down each sorted column sequentially to compile the final encrypted output.

Step-by-Step ADFGX Encryption Example

Let's encrypt the word "HELLOWORLD" using the Polybius key "DEUTSCHLAND" and transposition key "CARGO":

  1. Generate the Polybius Grid: Using the key "DEUTSCHLAND" (unique letters: D, E, U, T, S, C, H, L, A, N) and merging "J" into "I", we get the following grid:
      A D F G X
    A D E U T S
    D C H L A N
    F B F G I K
    G M O P Q R
    X V W X Y Z
  2. Substitute Plaintext Letters: We map each letter of "HELLOWORLD" (merging J to I):
    • H → DF
    • E → AD
    • L → DF
    • L → DF
    • O → DG
    • W → XF
    • O → DG
    • R → GX
    • L → DF
    • D → AA
    This gives the intermediate string: DF AD DF DF DG XF DG GX DF AA (20 characters).
  3. Write to Transposition Grid: Using the transposition key "CARGO" (length 5), we fill the grid:
    C A R G O
    ---------
    D F A D D
    F D F D G
    X F D G G
    X D F A A
  4. Sort Key Columns Alphabetically: We sort the columns alphabetically by their headers: A, C, G, O, R:
    A C G O R
    ---------
    F D D D A
    D F D G F
    F X G G D
    D X A A F
  5. Read Columns Downward: Reading down columns in sorted order (A, C, G, O, R):
    • A: F D F D
    • C: D F X X
    • G: D D G A
    • O: D G G A
    • R: A F D F
    Yielding the final ciphertext: FDFD DFXX DDGA DGGA AFDF.

Frequently Asked Questions

How secure was the ADFGX cipher during WWI?

At its introduction, it was exceptionally secure. The French military's top cryptanalyst, **Georges Painvin**, spent months of exhausting work in late 1917 and early 1918 to crack the cipher. He eventually succeeded by recognizing patterns in key distribution and message lengths, providing critical intelligence that helped halt the German spring offensive.

Why was the ADFGX cipher eventually updated to ADFGVX?

The $5 \times 5$ Polybius square used in ADFGX could only represent 25 characters, which meant digits (0-9) had to be spelled out in letters, drastically increasing transmission lengths. To solve this and add security, the Germans expanded the grid in June 1918 to a $6 \times 6$ square called **ADFGVX**, which could natively represent all 26 letters and 10 digits.

Does the order of transposition keys affect decryption?

Absolutely. Because the ciphertext columns are read in alphabetical order, any deviation in the transposition key shifts the sorted order, rendering the intermediate columns completely mismatched and making decryption impossible. Both the Polybius key and Transposition key are critical factors.

logo OnlineMiniTools

OnlineMiniTools.com is your ultimate destination for a wide range of web-based tools, all available for free.

Feel free to reach out with any suggestions or improvements for any tool at admin@onlineminitools.com. We value your feedback and are continuously striving to enhance the tool's functionality.

© 2026 OnlineMiniTools . All rights reserved.

Hosted on Hostinger

v1.10.0