Keyword substitution cipher — a mixed alphabet from one word

A keyword substitution cipher writes the keyword's letters first and the rest of the alphabet after them, then swaps each letter of your message for the one in the same position; the tool shows the cipher alphabet it used.

Live demo · real result from this tool
Direction

Result

Siaa zq lkba. Va zoa rfpbluaoar! Cipher alphabet: ZEBRASCDFGHIJKLMNOPQTUVWXY

Processed on your device — nothing is uploaded.

How to use the keyword substitution tool

  1. Choose the Direction: Encrypt or Decrypt.
  2. Enter the Keyword. The default is ZEBRAS.
  3. Type into Your text.
  4. Read the Result. Under the converted text the tool prints the Cipher alphabet, so you can check it or write it down for the reader.

What it does and when to use it

A keyword cipher is a simple substitution cipher with an easy-to-share key. Instead of agreeing on a full scrambled alphabet of 26 letters, you only have to agree on one word. Writing the alphabet out by hand is quick, which is why keyword ciphers show up in children’s spy books, classroom codes, escape rooms and cryptogram puzzles.

This is a classical cipher for puzzles and teaching, and it offers no real protection. For a substitution set by a formula instead of a word, try the affine cipher; for one where the substitution changes from letter to letter, see the autokey Vigenère cipher. The same keyword-square idea is used in two dimensions by the Playfair cipher.

How it works

With the keyword ZEBRAS, the two alphabets line up like this:

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

Encrypting finds each letter in the top row and writes the letter below it, so F becomes S and L becomes I. Decrypting does the reverse, from the bottom row to the top. Lower-case letters stay lower case, and anything that is not A to Z or a to z, including digits, punctuation and accented letters, is copied as it is. The work happens in your browser.

Worked examples

Results from the tool:

Flee at once. We are discovered!   ZEBRAS            →  Siaa zq lkba. Va zoa rfpbluaoar!
SIAA ZQ LKBA                       ZEBRAS, Decrypt   →  FLEE AT ONCE
Meet at 10, Zoë                    Secret Key        →  Http sp 10, Zjë

Each result is followed by a line such as “Cipher alphabet: ZEBRASCDFGHIJKLMNOPQTUVWXY”. In the first line the double E in “flee” becomes a double A, which shows how patterns survive. In the third, Secret Key gives the alphabet SECRTKYABDFGHIJLMNOPQUVWXZ; the 10 and the ë are untouched and Z stays Z.

Limits and tips

  • Remove spaces and punctuation before encrypting if you want to hide word lengths; the tool keeps them.
  • When you copy the result, leave out the “Cipher alphabet” line if the reader should not see it.
  • Longer keywords with many different letters make a more mixed alphabet, but never a secure one.

Frequently asked questions

How is the cipher alphabet built?
Take the keyword's letters in order, skip any letter already used, then add the letters of the alphabet that are not in the keyword, from A to Z. Secret Key gives S E C R T K Y, then A B D F G H I J L M N O P Q U V W X Z.
Why did some letters not change?
When the keyword uses only early or middle letters, the end of the cipher alphabet can line up with the normal alphabet. With Secret Key, Z still maps to Z. A keyword that includes late letters, such as ZEBRAS, mixes the alphabet more.
Do spaces or digits in the keyword matter?
No. Only the letters of the keyword are used, and case is ignored, so Secret Key and SECRETKEY are the same. An empty keyword gives the plain alphabet, and the text comes back unchanged.
Can this cipher be broken?
Easily. Each letter always becomes the same other letter, so letter frequencies, common short words and double letters give it away; newspaper cryptogram puzzles are exactly this kind of cipher. Use it for games and learning only.

Written by the ToolsRift team · Last updated

Pages are drafted with AI assistance and checked by automated tests. How we write and check pages.

Was this tool useful?

Report a problem

Start typing to search every tool.

↑ ↓ to moveEnter to openEsc to close