Substitution Cipher Encoder & Decoder

Keyword-seeded monoalphabetic substitution, all in your browser.

Free monoalphabetic substitution cipher — encrypt and decrypt text with a keyword-seeded cipher alphabet, entirely in your browser. Case is preserved and nothing is uploaded. It runs free in your browser on Gera Tools, with nothing uploaded.

Last updated Source: Gera Tools

How is the cipher alphabet built from the keyword?

The unique letters of the keyword (in order of first appearance) are placed at the start of the cipher alphabet, then the remaining unused letters follow in normal alphabetical order. Each plain letter maps to the cipher letter in the matching position.

A monoalphabetic substitution cipher replaces every letter with a fixed partner. This tool seeds that partner mapping from a keyword, making it easy to share a cipher with someone who only needs to remember a single word — handy for puzzles, escape rooms, classroom cryptography, and casual note-hiding.

How it works

The cipher alphabet is built in two steps:

  1. Keyword letters first. Take the keyword’s unique letters in the order they first appear and place them at the front of a new 26-letter alphabet.
  2. Fill the rest. Append every remaining letter of A–Z that the keyword did not use, in normal order.

Each plain letter A, B, C… then maps to the cipher letter in the same position. Encrypting applies this mapping; decrypting applies its inverse. Case is preserved, and anything that is not a letter passes through untouched.

Worked example

Keyword ZEBRA produces the cipher alphabet:

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 C D F G H I J K L M N O P Q S T U V W X Y

So HELLO enciphers to FAJJM. Decrypting FAJJM with the same keyword returns HELLO. Notice that both Ls in HELLO map to the same cipher letter J — this is the defining property of a monoalphabetic cipher, and also its main weakness.

How frequency analysis breaks it

A monoalphabetic cipher is interesting historically because it was used for centuries before being definitively broken. The attack is called frequency analysis: in English, the letter E appears in about 13% of text, T in about 9%, and A in about 8%. If you encrypt a long English message, the most frequent cipher letter is almost certainly the substitute for E, the second most frequent is probably T, and so on.

With a few hundred characters of ciphertext, an attacker can guess the likely substitutes for the 8–10 most common letters purely from frequency, then confirm by looking for common short words (THE, AND, IS) and working outward. The full mapping usually becomes clear from a few hundred words of ciphertext.

This means the keyword-substitution cipher is not suitable for protecting sensitive information, regardless of how obscure the keyword is. It is excellent for:

  • Escape room puzzles and puzzle hunts
  • Classroom demonstrations of classical cryptography
  • Game ARGs and narrative ciphers for storytelling
  • Teaching frequency analysis as an exercise in codebreaking

Choosing a good keyword for puzzles

For puzzle purposes (where breaking it is the intended challenge), shorter keywords with many repeated letters give a weaker shuffle — the keyword AAA has only one unique letter and leaves the alphabet nearly unchanged. Longer keywords with uncommon letters (Q, X, Z) displace more of the alphabet toward the front, producing a more scrambled mapping and a more satisfying solve.

Everything runs in your browser; nothing is uploaded.