ADFGVX Cipher Encoder Decoder

Encrypt letters and digits into ADFGVX cipher text or decrypt an ADFGVX message back to readable text.

By Hommer Zhao · Updated October 6, 2026

Free Online Tool

Use a keyworded 6x6 square and a columnar transposition key to explore this expanded World War I cipher.

TL;DR
  • ADFGVX turns each letter or digit into two letters from A, D, F, G, V, X, then scrambles those letters by column.
  • You need both keywords to decrypt: the square keyword and the transposition key.
  • Only A to Z and 0 to 9 are kept; spaces, punctuation and case are not.
  • It is historical and educational, not secure modern encryption.
How the ADFGVX Cipher Works

The ADFGVX cipher is a fractionating cipher that starts with a keyed Polybius square. Each plaintext letter or digit becomes a two-letter coordinate using the labels A, D, F, G, V, and X.

A columnar transposition cipher is a cipher that writes text across rows under a keyword, then reads columns in sorted keyword order. In ADFGVX, this second step scrambles the coordinate stream after substitution, making it harder to read direct symbol patterns.

The historical ADFGVX cipher expanded the earlier ADFGX system by adding the coordinate letter V and using a 36-cell square. This tool follows the common A-Z plus 0-9 version for practical encoding and decoding.

Worked Example: ATTACK AT 1200 with square CIPHER and key CARGO

These steps are produced by the same functions as the tool above, so what you see is what the tool returns.

Step 1: build the square

The keyword CIPHER goes first, then the remaining letters and digits in order (repeated letters are skipped). Each cell is named by its row and column letters.

ADFGVX
ACIPHER
DABDFGJ
FKLMNOQ
GSTUVWX
VYZ0123
X456789

Step 2: replace each symbol by its coordinates

Spaces are dropped, then A T T A C K A T 1 2 0 0 becomes 24 letters:

DAGDGDDAAAFADAGDVGVVVFVF

Step 3: write them under the key in rows

The key CARGO has 5 letters, so the stream is written in rows of 5. The last row is short, so some columns are one letter longer than others.

CARGO
DAGDG
DDAAA
FADAG
DVGVV
VFVF

Step 4: read the columns in key order

Sorted alphabetically the key letters read A C G O R, so read the column under each in that order:

ADAVF DDFDV DAAVF GAGV GADGV

The same two steps reproduce the published example on Wikipedia: with its square and the key PRIVACY, “attack at 1200am” gives DGDD DAGD DGAF ADDF DADV DVFA ADVX. We check that result in our tests.

More Examples: Real Output, Limits and Pitfalls

Typical: a short message with digits

Encrypt · square CIPHER · key CARGO

Input

ATTACK AT 1200

Result

ADAVF DDFDV DAAVF GAGV GADGV

Digits go straight into the 36-cell square. The result is shown in five groups, one per key column, read in alphabetical key order.

Typical: decrypting with both keys

Decrypt · square CIPHER · key CARGO

Input

ADAVF DDFDV DAAVF GAGV GADGV

Result

ATTACKAT1200

Decryption needs both the square keyword and the transposition key. Spaces and the group layout are ignored, so the length of the whole ciphertext is what recovers the columns.

Typical: different keys, different ciphertext

Encrypt · square RADIO · key TRAIN

Input

MEET AT GATE 7

Result

DDDD DAGD DDAD FGDGG FDGDX

Changing either keyword changes the whole result: the square decides each letter’s coordinate pair and the key decides the column order.

Limit: spaces, punctuation and case are not kept

Encrypt · square CIPHER · key CARGO

Input

Attack at dawn, 5:30!

Result

ADADVV DDFDGD DAADGV GAGAXF GADFFX

Only A to Z and 0 to 9 are encrypted. The comma, colon, exclamation mark and spaces are dropped, and lower case becomes upper case. Decrypting returns one unbroken run of capitals, so the receiver has to re-insert word breaks.

Pitfall: the wrong square gives plausible-looking nonsense

Decrypt · square RADIO · key CARGO

Input

ADAVF DDFDV DAAVF GAGV GADGV

Result

CTTCRKCT1200

The same ciphertext decrypted with square RADIO instead of CIPHER returns no error, only wrong text. If a decryption looks like gibberish, check both keywords before suspecting the method.

Pitfall: the wrong transposition key scrambles the columns

Decrypt · square CIPHER · key TRAIN

Input

ADAVF DDFDV DAAVF GAGV GADGV

Result

UIATAAPHWG2O

With the right square but the wrong transposition key, the coordinate pairs are cut in the wrong places, so even the first letters are usually wrong.

Boundary: a missing letter breaks everything after it

Decrypt · square CIPHER · key CARGO

Input

ADAVF DDFDV DAAVF GAGV GADG

Result

AZLFHKCIZ10?

One letter was lost from the end. The column lengths are recomputed from the shorter total, so the pairs shift and an incomplete final pair shows as a question mark.

History and Use Cases

The cipher was invented by the German signal officer Fritz Nebel. The 5x5 ADFGX version was first used on 1 March 1918 and the expanded ADFGVX version on 1 June 1918. The coordinate letters were chosen because A, D, F, G, V and X are easy to tell apart in Morse code and so reduce telegraph copying errors. The French lieutenant Georges Painvin broke ADFGX in April 1918 and ADFGVX in early June 1918 (source: Wikipedia, ADFGVX cipher).

ADFGVX is historically important because it combines substitution, fractionation, and transposition in a hand-operable system. The 6x6 square made number-heavy military traffic easier to encode than with the older 5x5 ADFGX variant.

Today, ADFGVX is best used for classroom cryptography, puzzle design, escape-room clues, CTF warmups, and demonstrations of how layered classical ciphers can still be attacked with enough ciphertext and context.

Practical Notes

6x6 Square

ADFGVX keeps A through Z and 0 through 9 in one keyed grid, so J does not need to merge with I.

Two Keys

The square keyword controls substitution while the transposition key controls the final column permutation.

Educational Use

Use it for historical learning, classroom exercises, CTF warmups, and puzzle construction.

Frequently Asked Questions

What is the ADFGVX cipher?

ADFGVX is a World War I field cipher that combines two steps. First a keyed 6x6 Polybius square turns each letter or digit into a two-letter coordinate made from A, D, F, G, V and X. Then a columnar transposition, controlled by a second keyword, reorders those coordinate letters.

How is ADFGVX different from ADFGX?

ADFGX uses a 5x5 square, so it has no digits and must combine two letters. ADFGVX adds the coordinate letter V to make a 6x6 square, which holds all 26 letters and the digits 0 to 9.

What do I need to decrypt an ADFGVX message?

Both keywords: the square keyword and the transposition key. With only one of them the tool still returns text, but it is wrong. This tool builds the square from a keyword followed by the remaining letters and digits in order, so it cannot decrypt a message that used a fully scrambled 36-cell square unless that square can be written as a keyword plus the rest in order.

Why did my spaces and punctuation disappear?

Only A to Z and 0 to 9 can be placed in the square. Spaces, punctuation and other characters are dropped before encryption, and lower case becomes upper case, so decryption returns one run of capitals and the receiver restores the word breaks.

Does the grouping of the ciphertext matter when I decrypt?

No. The tool ignores spaces and any character outside A, D, F, G, V and X, and works from the total length. The groups in the output simply show one transposition column each. A missing or extra letter shifts every column and corrupts the rest of the message.

Who invented and who broke the ADFGVX cipher?

It was invented by the German signal officer Fritz Nebel. ADFGX was first used on 1 March 1918 and ADFGVX on 1 June 1918. The French lieutenant Georges Painvin broke ADFGX in April 1918 and ADFGVX in early June 1918 (source: Wikipedia, ADFGVX cipher).

Is the ADFGVX cipher secure today?

No. It is useful for history, puzzles and learning how substitution and transposition combine, but it should not protect anything sensitive. Use modern, reviewed encryption for real secrecy.

Related methods: the 5x5 ADFGX cipher, the Polybius square, the columnar transposition cipher and the Bifid cipher, another fractionating cipher.