Quagmire Cipher Decoder & Encoder

The Quagmire cipher is a family of four periodic polyalphabetic ciphers that use keyword-based substitution alphabets. Developed by the American Cryptogram Association, each variant (I through IV) applies different combinations of keyword-mixed and standard alphabets with an indicator key. Use this free tool to encode and decode messages with any Quagmire type instantly.

Result
0 characters
Variant:Quagmire IQuagmire IIQuagmire IIIQuagmire IVKeyed plaintext, standard cipher
Keyword:
Indicator:
Options:Preserve Case

Quagmire I Cipher Configuration

Plaintext Alphabet

C
I
P
H
E
R
A
B
D
F
G
J
K
L
M
N
O
Q
S
T
U
V
W
X
Y
Z

Ciphertext Alphabet

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

Indicator Key: KEY

Period length: 3
Quagmire I: Keyed plaintext, standard cipher
Uses keyword-generated plaintext alphabet with standard cipher alphabet

Frequently Asked Questions About Quagmire Cipher

What is the Quagmire cipher?

It is a family of four periodic polyalphabetic substitution ciphers developed by the American Cryptogram Association. Each variant uses keyword-mixed alphabets and an indicator key to generate multiple cipher alphabets. The four types differ in which alphabets (plaintext, ciphertext, or both) are keyword-mixed, providing progressively stronger encryption.

What are the four Quagmire cipher types?

Quagmire I uses a keyword-mixed plaintext alphabet with a standard ciphertext alphabet. Quagmire II uses a standard plaintext alphabet with a keyword-mixed ciphertext alphabet. Quagmire III uses the same keyword-mixed alphabet for both plaintext and ciphertext. Quagmire IV uses two different keyword-mixed alphabets for plaintext and ciphertext, making it the most complex variant.

How does Quagmire I differ from Quagmire IV?

Quagmire I is the simplest variant, requiring only one keyword to mix the plaintext alphabet while using a standard ciphertext alphabet. Quagmire IV is the most complex, requiring two separate keywords to independently mix both the plaintext and ciphertext alphabets. This gives Quagmire IV a much larger keyspace and makes it significantly harder to break through cryptanalysis.

How do you encrypt with the Quagmire cipher?

First select a variant type (I-IV) and enter the required keywords and indicator key. For each plaintext letter, find its position in the plaintext alphabet, then look up the corresponding letter in the ciphertext alphabet that has been shifted according to the current indicator key letter. The indicator key repeats across the message, cycling through different alphabet shifts.

How is Quagmire related to the Vigenere cipher?

The Quagmire cipher extends the Vigenere concept. Quagmire II with a standard alphabet and no keyword mixing is essentially equivalent to the Vigenere cipher. The Quagmire family adds keyword-mixed alphabets on top of the periodic polyalphabetic substitution that Vigenere introduced, creating more complex and harder-to-break encryption while keeping the same periodic key structure.

How do you break a Quagmire cipher?

Start by determining the key period using Kasiski examination or index of coincidence analysis. Once the period is known, separate the ciphertext into groups encrypted by each key letter and apply frequency analysis to each group. For keyword-mixed variants, pattern analysis and word-guessing techniques help recover the mixed alphabet. Quagmire IV is hardest to break because both alphabets must be recovered independently.

Which Quagmire type is the most secure?

Quagmire IV is the most secure variant. It uses two independent keyword-mixed alphabets for plaintext and ciphertext, creating the largest keyspace and the most irregular substitution patterns. Each additional keyword multiplies the complexity an attacker must overcome. However, all Quagmire types remain vulnerable to modern computational cryptanalysis when sufficient ciphertext is available.

What is the Quagmire Cipher?

The Quagmire cipher is a family of four periodic polyalphabetic substitution ciphers that extends the Vigenere cipher through keyword-mixed alphabets. Named for the difficulty cryptanalysts face when attempting to solve them, the system was classified by the American Cryptogram Association (ACA) into Types I through IV.

Unlike the Vigenere cipher which only shifts standard alphabets, the Quagmire family uses keyed alphabets that completely scramble letter frequency relationships. This makes the ciphertexts far more resistant to frequency analysis and other classical cryptanalysis techniques.

The Four Quagmire Variants

Quagmire I

Uses a keyword-mixed plaintext alphabet with straight (standard) ciphertext alphabets. The simplest variant and an excellent introduction to keyed alphabet ciphers. Requires two keywords: one for the plaintext alphabet and an indicator keyword.

Quagmire II

Reverses the configuration: a straight plaintext alphabet with keyword-mixed ciphertext alphabets. Provides equivalent security to Type I but with a different cryptanalytic attack surface. Also requires two keywords.

Quagmire III (Keyed Vigenere)

The most popular variant, also known as the Keyed Vigenere cipher. Uses the same keyed alphabet for both plaintext and ciphertext positions. Strikes an optimal balance between security and usability, which explains its popularity in ACA competitions and geocaching puzzles.

Quagmire IV

The most secure variant, using two different keyed alphabets — one for plaintext and another for ciphertext. Requires three keywords total, creating the largest keyspace. Breaking it without a good crib is extremely difficult.

Comparison Table

FeatureType IType IIType IIIType IV
Plaintext AlphabetKeyedStraightKeyed (same)Keyed
Ciphertext AlphabetStraightKeyedKeyed (same)Keyed (different)
Keywords Required2223
Security LevelGoodGoodBetterBest
Best ForLearningVariationGeneral UseMaximum Security

How It Works

Creating Keyed Alphabets

Take your keyword and remove duplicate letters, then append the remaining alphabet letters in order. For example, the keyword CIPHER produces: CIPHERABDFGJKLMNOQSTUVWXYZ.

Building the Cipher Table

The indicator keyword determines how many cipher alphabets you use and their rotation. Each indicator letter corresponds to a specific shift of the keyed alphabet. The indicator position parameter (typically A) controls the alignment.

Encryption Example (Type I)

Setup: Plaintext Keyword: CIPHER, Indicator: KEY, Position: A

Plain:   C I P H E R A B D F G J K L M N O Q S T U V W X Y Z
[K] C0:  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
[E] C1:  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
[Y] C2:  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

Encrypting HELLO: H→S, E→I, L→V, L→Y, O→S = SIVYS

Quagmire vs Vigenere Cipher

The fundamental difference lies in alphabet construction. The Vigenere cipher uses only shifted standard alphabets, maintaining relative frequency relationships. The Quagmire system scrambles these relationships through keyed alphabets, making frequency analysis far more difficult.

Quagmire II with a standard alphabet and no keyword mixing is essentially equivalent to the Vigenere cipher. Each subsequent type adds complexity on top of the periodic polyalphabetic framework.

Cryptanalysis and Security

All Quagmire variants can be broken with sufficient ciphertext and the right approach:

  1. Period detection — Use Kasiski examination or Index of Coincidence to determine the indicator keyword length
  2. Crib analysis — Known or suspected plaintext fragments allow key recovery
  3. Frequency analysis — After period detection, analyze each group independently
  4. Brute force — Feasible for short indicator keywords (3-5 letters)

Type IV is the hardest to break since both alphabets must be recovered independently.

Features

  • All four variants supported in one tool
  • Real-time encryption and decryption as you type
  • Alphabet tableau visualization to understand the substitution process
  • Smart keyword validation with duplicate removal
  • Copy and download results in standard five-letter groups
  • Mobile responsive design