Skip to content

ADFGVX cipher encoder and decoder

How it works

ADFGVX combines two stages. First, a six-by-six square contains A–Z and 0–9. Its rows and columns are labeled A, D, F, G, V, and X. Every plaintext character becomes two coordinate letters. The unusual labels were chosen because their Morse-code patterns are distinct, reducing transmission mistakes.

The grid can begin with a keyword. Unique letters and digits from that keyword fill the first cells, followed by unused characters in standard order. A separate transposition keyword names the columns for the second stage. These are two independent keys: changing either one changes the final ciphertext.

After fractionation, write the ADFGVX coordinate stream row by row beneath the transposition keyword. Sort the keyword letters alphabetically, keeping duplicate letters in their original order, and read the corresponding columns from top to bottom. Decoding calculates each original column length, restores the row-wise stream, and then converts coordinate pairs through the grid.

Plaintext may contain letters and digits. Ciphertext may contain only the six coordinate letters after formatting is removed. The transposition keyword needs at least two alphabetic characters. The current keyed grid is visible in the interface so every substitution can be checked by hand.

Worked example

Encode ATTACK with the standard A–Z, 0–9 grid and transposition keyword CARGO. The first stage produces ADFGVX coordinate pairs.

PlainGrid pairFractionated stream positionColumn under CARGO
AAA1–2C then A
TGD3–4R then G
TGD5–6O then C
AAA7–8A then R
CAF9–10G then O
KDV11–12C then A
  1. Build the grid: Fill the six-by-six ADFGVX square with A–Z and 0–9.
  2. Fractionate the plaintext: Convert ATTACK to AA GD GD AA AF DV, giving AAGDGDAAAFDV.
  3. Write beneath the key: Place the stream row by row under CARGO.
  4. Read sorted columns: Read columns in A, C, G, O, R order to obtain AAVADDDAGFGA.

The fractionated stream is AAGDGDAAAFDV. Written under CARGO, the original columns are ADD, AAV, GA, DA, and GF. Reading columns in A, C, G, O, R order gives AAVADDDAGFGA.

History and origin

German signals officer Fritz Nebel introduced the related ADFGX cipher during the First World War. It used a five-by-five grid for letters and entered operational use in 1918. The expanded ADFGVX version added a sixth row and column so the square could carry digits as well as letters.

French cryptanalyst Georges Painvin broke major ADFGX traffic in 1918 despite difficult conditions and limited messages. His work showed that combining substitution and transposition could still leak enough structure for a determined analyst. The cipher remains a prominent case study in wartime hand cryptography.

How to break it

ADFGVX is not secure by modern standards. The coordinate substitution expands each plaintext character into two symbols, and the columnar transposition rearranges them, but neither stage has a modern-sized key space or resistance to statistical search. Reused keys across enough traffic provide an analyst with strong leverage.

Attacks examine column lengths, repeated fragments, likely words, and the statistical relationships between coordinate pairs. If the transposition is reconstructed, the remaining stream is a small Polybius substitution problem. Computers can score candidate column orders and grid arrangements far faster than historical hand analysis.

The cipher is useful for teaching composition: combining two weak transformations can make analysis harder without making the result modern encryption. Use ADFGVX for historical exercises and puzzles only. Do not use it for personal data, credentials, business records, or any message whose disclosure would matter.

Frequently asked questions

What do the letters ADFGVX mean?

They label the six rows and six columns of the substitution square. Their Morse patterns are distinct, which helped reduce transmission errors.

Can ADFGVX encrypt numbers?

Yes. Its six-by-six grid has thirty-six cells, enough for all 26 letters and ten digits.

Why does ADFGVX need two keywords?

One keyword disorders the grid. The other labels and sorts the columns used for transposition. Both must match during decoding.

How do I decode an ADFGVX cipher?

Undo the columnar transposition using the transposition keyword, split the restored stream into coordinate pairs, and look up each pair in the keyed grid.

What is the difference between ADFGX and ADFGVX?

ADFGX uses a five-by-five letter grid. ADFGVX adds V as a sixth label and supports letters plus digits.

Is the ADFGVX cipher secure today?

No. Historical and computerized attacks can recover its transposition and grid from sufficient ciphertext. It should be used only for education and puzzles.

Privacy note

All processing happens in your browser. Your text never leaves your device and is never transmitted to ToolPlex.