A tool for understanding Quagmire I, II, III, and IV ciphers that use a keyword. All four versions are variants of the Vigenère cipher.
Quagmire Cipher - dCode
Tag(s) : Poly-Alphabetic Cipher
dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!
Quagmire can refer to 4 types of polyalphabetic ciphers (which are variants of the Vigenere cipher)
Quagmire I: the plaintext alphabet is mixed with a keyword, the ciphertext alphabet remains straight (A-Z).
Quagmire II: the plaintext alphabet is straight (A-Z), the ciphertext alphabet is mixed with a keyword.
Quagmire III: both alphabets are mixed with the same keyword.
Quagmire IV: both alphabets are mixed with two different keywords.
A Quagmire is a periodic polyalphabetic substitution cipher, a direct cousin of the Vigenere cipher, in which one or both substitution alphabets is a mixed alphabet built from a keyword.
The only difference lies in the creation of the cipher table.
The table displays the plaintext alphabet (the letters of the plaintext message) in the column headers, and $ n $ rows representing the $ n $ alphabets (the letters of the ciphertext message).
Below are the various tables generated using the keyword CLE (with A as the indicator letter).
For a classic Vigenère cipher, the table is:
| A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| (1) | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | A | B | C | D | E | F | G | H | I | J |
| (2) | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | A | B | C | D |
| (3) | Y | Z | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X |
Example: MESSAGE becomes WIQCEEO
For Quagmire, a mixed alphabet is used—in this case, based on the word WORD.
In Quagmire 1, it modifies the plain alphabet (at the top of the columns)
| W | O | R | D | A | B | C | E | F | G | H | I | J | K | L | M | N | P | Q | S | T | U | V | X | Y | Z | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| (1) | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | A | B | C | D | E | F |
| (2) | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z |
| (3) | U | V | W | X | Y | Z | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T |
Example: MESSAGE becomes VHNZEDN
In Quagmire 2, he modifies the cipher alphabet (within the grid)
| A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| (1) | K | L | M | N | P | Q | S | T | U | V | X | Y | Z | W | O | R | D | A | B | C | E | F | G | H | I | J |
| (2) | E | F | G | H | I | J | K | L | M | N | P | Q | S | T | U | V | X | Y | Z | W | O | R | D | A | B | C |
| (3) | Y | Z | W | O | R | D | A | B | C | E | F | G | H | I | J | K | L | M | N | P | Q | S | T | U | V | X |
Example: MESSAGE becomes ZINBEAP
In Quagmire 3, he modifies both alphabets simultaneously.
| W | O | R | D | A | B | C | E | F | G | H | I | J | K | L | M | N | P | Q | S | T | U | V | X | Y | Z | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| (1) | G | H | I | J | K | L | M | N | P | Q | S | T | U | V | X | Y | Z | W | O | R | D | A | B | C | E | F |
| (2) | D | A | B | C | E | F | G | H | I | J | K | L | M | N | P | Q | S | T | U | V | X | Y | Z | W | O | R |
| (3) | T | U | V | X | Y | Z | W | O | R | D | A | B | C | E | F | G | H | I | J | K | L | M | N | P | Q | S |
Example: MESSAGE becomes YHKREDN
For Quagmire IV, the two alphabets are mixed using two distinct keywords; in this case, the second word is PASS.
| W | O | R | D | A | B | C | E | F | G | H | I | J | K | L | M | N | P | Q | S | T | U | V | X | Y | Z | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| (1) | G | H | I | J | K | L | M | N | O | Q | R | T | U | V | W | X | Y | Z | P | A | S | B | C | D | E | F |
| (2) | S | B | C | D | E | F | G | H | I | J | K | L | M | N | O | Q | R | T | U | V | W | X | Y | Z | P | A |
| (3) | U | V | W | X | Y | Z | P | A | S | B | C | D | E | F | G | H | I | J | K | L | M | N | O | Q | R | T |
Example: MESSAGE becomes XHLAEBN
The encryption mechanism is common to all four variants:
— create an encipherment tableau (from a plaintext alphabet and a ciphertext alphabet, straight or mixed depending on the variant);
— choose an indicator keyword whose length $ n $ sets the period;
— split the message into groups of $ n $ letters
— encipher the i-th letter of each group with the i-th substitution alphabet
The English word quagmire means swamp, bog, mire
The four variants differ only by the nature of the two alphabets; everything else (period, indicator, splitting) is identical.
— Quagmire I combines a mixed plaintext alphabet and a straight ciphertext alphabet (key type K1)
— Quagmire II reverses the layout: straight plaintext alphabet and mixed ciphertext alphabet (key type K2).
— Quagmire III uses the same mixed alphabet on both sides, for plaintext and ciphertext (key type K3)
— Quagmire IV, the most complex, uses two different mixed alphabets (key type K4) and requires two alphabet keywords.
This is the K1 to K4 classification of keyed alphabets by the ACA (American Cryptogram Association).
dCode retains ownership of the "Quagmire Cipher" source code. Any algorithm for the "Quagmire Cipher" algorithm, applet or snippet or script (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or any "Quagmire Cipher" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) or any database download or API access for "Quagmire Cipher" or any other element are not public (except explicit open source licence). Same with the download for offline use on PC, mobile, tablet, iPhone or Android app.
Reminder: dCode is an educational and teaching resource, accessible online for free and for everyone.
The content of the page "Quagmire Cipher" and its results may be freely copied and reused, including for commercial purposes, provided that dCode.fr is cited as the source (Creative Commons CC-BY free distribution license).
Exporting the results is free and can be done simply by clicking on the export icons ⤓ (.csv or .txt format) or ⧉ (copy and paste).
To cite dCode.fr on another website, use the link:
In a scientific article or book, the recommended bibliographic citation is: Quagmire Cipher on dCode.fr [online website], retrieved on 2026-11-05,