ForHosting KIT · Developer Utilities

ADFGVX cipher

Encrypt or decrypt with the six-by-six German field cipher that handles letters and digits: ATTACKAT1200, with square keyword PRIVACY and transposition key GERMAN, becomes GFVVVVVVAAAVGXGFGFGFGAGV. Decrypt with the same two keys to get it back. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon
If you enter
Text
ATTACKAT1200
Square key
PRIVACY
Key
GERMAN
Calculation mode
Encrypt
You get
Result
GFVVVVVVAAAVGXGFGFGFGAGV
Input
ATTACKAT1200
Square key used
PRIVACY
Normalized
ATTACKAT1200

The ADFGVX cipher is the six-by-six German field cipher that fractionated messages through a keyed Polybius-style square and then scrambled the resulting label stream with a second transposition keyword. Unlike a simple substitution or a pure columnar transposition, ADFGVX combines both stages so each plaintext letter or digit becomes a pair of labels drawn from the set A, D, F, G, V, and X before those labels are written into a grid and read in keyword order. This capability accepts a square keyword, a transposition key, the text to protect or recover, and a mode of encrypt or decrypt.

How the 6×6 square and fractionation work

ADFGVX begins by turning your square keyword into a six-by-six matrix over the thirty-six symbols formed by the Latin letters A through Z and the decimal digits zero through nine. Letters and digits from the square keyword are written left to right, top to bottom, skipping duplicates and uppercasing letters; the remaining unused symbols of the alphabet and digit set fill the rest of the grid in natural order.

Rows and columns are labeled with the six Morse-friendly letters A, D, F, G, V, and X rather than digits one through six. On encrypt, plaintext is reduced to uppercase alphanumerics only, then each symbol is replaced by the two labels of its cell—row label first, then column label—producing a continuous stream twice as long as the normalized message. That fractionated stream is the input to the second stage.

On decrypt, after the transposition is inverted, every consecutive pair of ADFGVX labels is looked up in the same square to recover one letter or digit.

Practical tips, limits, and related searches

Choose a square keyword with several distinct letters and optional digits so the matrix is not nearly alphabetical; short memorable words still work for demos, but longer phrases with unique symbols shuffle the square more. Choose a transposition key with mixed letters so column order is not left-to-right identity; repeated letters are allowed and break ties by position.

Remember that spaces, punctuation, and other non-alphanumerics are stripped before encryption, so phone numbers keep their digits but lose separators, and mixed labels lose punctuation in the symbol stream—pre-segment or encode those separately if you need them later. For decryption, feed an ADFGVX-only ciphertext stream of even length after normalization; if a printed worksheet still has spaces, the solver ignores non-label characters. Round-trip checks are the best sanity test: encrypt a phrase that includes digits, decrypt the result with the same two keys, and compare against the normalized alphanumeric plaintext.

Prefer this capability when you need transparent classical ADFGVX cryptography for education or puzzles; if you need real secrecy, use a modern authenticated cipher instead.

CTF and puzzle write-ups

Challenge authors verify ADFGVX encrypt and decrypt steps for published square and transposition keys without maintaining a separate offline script.

Historical crypto demos

Museums and blog demos show how WWI fractionating ciphers differ from monoalphabetic substitution by live-encrypting visitor phrases that include times or unit numbers.

What is the ADFGVX cipher?

A classical German field cipher: each letter or digit maps to a pair of A/D/F/G/V/X labels via a 6×6 keyword square, then the label stream is rearranged with a columnar transposition key.

Why six labels A, D, F, G, V, X?

Those six letters have distinct Morse code patterns, which reduced field transmission errors when operators sent the fractionated ciphertext by wireless telegraph.

What happens if a key is missing or empty?

Both the square keyword and the transposition key are required and must be non-empty (the square key needs at least one A–Z or 0–9 character).

Does ADFGVX support digits?

Yes. The 6×6 square holds twenty-six letters and ten digits, so messages like ATTACKAT1200 can be encrypted without stripping the time digits.

Is the ADFGVX cipher free?

The browser tool is free and runs locally.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/enc/adfgvx

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/enc/adfgvx \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"ATTACKAT1200","square_key":"PRIVACY","key":"GERMAN"}'
{
  "text": "ATTACKAT1200",
  "square_key": "PRIVACY",
  "key": "GERMAN"
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "enc.adfgvx",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

It reports missing or empty keys with a clear invalid_input error so a blank form never silently produces a meaningless identity transform.

How the transposition key, API fields, and response work

After fractionation, the label stream is written row-wise into a grid whose width equals the length of the transposition key. Columns are then read in the order obtained by sorting the key characters in Unicode order, using the original left-to-right index as a stable tie-break when the same letter repeats. Decrypt reverses that step: the ciphertext labels fill the columns in keyword order according to each column height for the stream length, then the grid is read left to right, top to bottom. Text must yield usable symbols after normalization—letters or digits on encrypt, ADFGVX labels on decrypt. Send a JSON body with three required string fields—text, square_key, and key—plus an optional mode that defaults to encrypt when omitted. Accepted aliases for text include input, value, data, message, plaintext, and ciphertext; square_key also accepts square_keyword, polybius_key, keyword, and square; key accepts transposition_key, column_key, tkey, and colkey; mode accepts operation, op, direction, and action, and recognizes common synonyms such as encode or decode. Either key missing or empty is invalid_input and is never charged. On success the response echoes the original text and keys, reports square_key_used as the distinct square-keyword symbols in fill order, mode as encrypt or decrypt, normalized and fractionated intermediate streams, result and text as the ciphertext labels or recovered symbols, square as the six rows of six cells, labels as the fixed ADFGVX set, column_order as the permutation of column indices, length and fractionated_length, formula as a short rule mnemonic, and message as a one-line English summary. Pricing is a flat $0.002 per successful request with unit item.

Practical tips, limits, and related searches

Keep payloads under the published maximum of one hundred thousand characters so Worker memory stays bounded. When teaching, pair examples: a classic square keyword such as PRIVACY with transposition GERMAN on a mixed message shows fractionation and column reordering; a short CODE42 demo shows digit cells; and an empty transposition key demonstrates the hard invalid_input path that reports the missing key. This landing targets people searching for an ADFGVX cipher, ADFGVX encryptor, or six-by-six fractionating transposition tool online; it is not AES, not a modern password vault, not Playfair, not plain Polybius, and not columnar transposition alone. Failed tasks that return invalid_input do not consume prepaid balance, which keeps exploratory scripts cheap when clients probe blank keys.

Classroom classical-cipher labs

Students build a 6×6 ADFGVX square by hand, fractionate a short mixed letter-digit message, apply the transposition key, then compare labels and the final stream against the deterministic API result.

Read the full KIT documentation →