Introduction

The Keyword cipher is a type of substitution cipher, specifically a monoalphabetic substitution cipher. This means that you replace a letter in the plaintext with the same letter every time. For example, if you replace the letter "A" with "H", you must do that for every "A" in the entire plaintext.

Consider the following random substitution table. There's no pattern to how the plaintext maps to the ciphertext. This is the setup to a Random substitution. I explain more how substitution works here.

Original Alphabet (Plaintext)

Substitution (Ciphertext)

The keyword cipher requires a "keyword." It's preferable the keyword has no repeated letters. For example, WIZARD is a good keyword. However, the word BASEBALL is bad. The letters "B", "A", and "L" are repeated. I'll discuss after the example what to do when the keyword has repeated letters.

Next step is remove all the letters from the ciphertext table. We're going to start with a clean slate. It should look like this.

Original Alphabet (Plaintext)

Substitution (Ciphertext)

Now we place our keyword in the first empty slots in the ciphertext table. Suppose our keyword is WIZARD. It should look like this.

Original Alphabet (Plaintext)

Substitution (Ciphertext)

The last step to creating our keyword encryption is to place all the remaining letters of the alphabet in the rest of the boxes. If a letter was used in the keyword then you skip over it.

Original Alphabet (Plaintext)

Substitution (Ciphertext)

Congrats! You created your first keyword encryption system using the keyword WIZARD.

How does it work?

To encrypt, replace all the letters of your plaintext with the corresponding letter in the ciphertext table. To decrypt, replace all the letters in your ciphertext with the corresponding letter in the plaintext table.

NOTE: If you want to use a keyword with repeated letters, then you have to remove those letters before placing it in the ciphertext boxes. For example, if you want to use BASEBALL, then you need to remove a "B", "A", and "L". So BASEBALL is now BASEL. See? Not that cool of a password now.

Example

Using the keyword WIZARD we get the following encryption for the message ATTACK AT DAWN

Plaintext: A T T A C K   A T   D A W N
Ciphertext: W Q Q W Z G   W Q   A W U K

The Keyword Cipher Tool

Enter your keyword below and click Generate. The ciphertext boxes will populate with the keyword cipher.

Original Alphabet (Plaintext)

Substitution (Ciphertext)

Encrypt your message

Use the tool above to set your key.


How to decrypt?

It's easy when you have the shift key. When you encrypt a message you shift all the letters to the RIGHT. To decrypt, you shift all the letters LEFT. If the shift key is K=3, then you shift all the letters LEFT by 3 letters.

Decrypt your message:

Use the shift tool from above.