Keyed Substitution Cipher

Create Custom Alphabets for Encryption

Step 1: Create Your Cipher Alphabet

Enter a keyword or phrase. Duplicate letters will be removed automatically.

💡 Tip: Longer keywords create stronger ciphers! Try phrases like "THEREBELSARECOMING"
Normal:
ABCDEFGHIJKLMNOPQRSTUVWXYZ
Cipher:
Generate alphabet first...

Complete Letter Mapping:

What is a Keyed Substitution Cipher?

A keyed substitution cipher uses a keyword or phrase to create a custom substitution alphabet. Unlike a simple Caesar cipher which shifts the entire alphabet, keyed substitution creates a completely scrambled alphabet based on your keyword.

How It Works

The cipher alphabet is created in three steps:

  1. Remove duplicates: Take your keyword and remove any duplicate letters
  2. Add remaining letters: Append all unused letters of the alphabet in order
  3. Substitute: Map each normal letter to its corresponding cipher letter

Example

Keyword: MATRIX

Process:

  • Remove duplicates: MATRIX (no duplicates)
  • Add remaining letters: MATRIXBCDEFGHJKLOPQSUVWYZ

Result:

Normal: ABCDEFGHIJKLMNOPQRSTUVWXYZ
Cipher: MATRIXBCDEFGHJKLOPQSUVWYZ

Example Encryption:

  • HELLO → CXGGJ
  • A→M, B→A, C→T, D→R, E→I, etc.

Key Features

History

Substitution ciphers have been used since ancient times. Julius Caesar used a simple version, but keyed substitution ciphers became popular in medieval times for diplomatic communications. Mary, Queen of Scots famously used a substitution cipher in her letters, which was eventually broken and used as evidence against her.

Breaking Keyed Substitution

Despite having many possible keys, keyed substitution ciphers can be broken using:

Modern Uses

While not secure for modern cryptography, keyed substitution is used for:

Tips for Stronger Keys

Frequently Asked Questions

Is the keyed substitution cipher secure?

No, it's not secure by modern standards. While it has many possible keys, it's vulnerable to frequency analysis. A skilled cryptanalyst can break it in minutes. It should only be used for educational purposes or puzzle games.

What happens with duplicate letters in my keyword?

Duplicates are automatically removed. For example, "HELLO" becomes "HELO" before generating the cipher alphabet. This ensures each letter appears only once in the cipher alphabet.

Can I decrypt with the same keyword?

Yes! The same keyword that encrypted the message will decrypt it. Just switch to "Decrypt" mode, enter the same keyword, and process your ciphertext.

What makes this different from Caesar cipher?

Caesar cipher shifts the entire alphabet by a fixed number (only 25 possibilities). Keyed substitution creates a completely scrambled alphabet based on your keyword, giving you over 400 septillion possible keys!

Does this work offline?

Yes! All encryption and decryption happens in your browser using JavaScript. Once the page loads, you can use it without an internet connection. Your text never leaves your device.