Substitution Cipher Decoder

Encrypt or decrypt a monoalphabetic substitution cipher with your own 26-letter key.

How to decode

  1. Known key: paste the original 26-letter alphabet into Substitution Key, in plaintext A–Z → ciphertext order.
  2. Select Ciphertext to Plain Text (decode mode) and paste your ciphertext. Decoded Plain Text updates automatically.
  3. Unknown key: use the frequency analysis tool to test ciphertext → plaintext guesses.
  4. Convert those guesses to this tool’s forward key: if ciphertext Q means plaintext A, put Q in the A position of the key. Repeat for all 26 letters; incomplete guesses are not a recovered complete key.

Detailed tool instructions · Compare cipher systems

Monoalphabetic vs Polyalphabetic Ciphers: the short answer

Monoalphabetic means one fixed alphabet mapping for the whole message. If A becomes Q, every A becomes Q. A polyalphabetic cipher changes the mapping with the key position: the same plaintext letter can become different ciphertext letters. Vigenère and Porta are examples.

The difference matters when breaking a cipher. A fixed substitution preserves the frequency of each letter under a new label, as well as repeated-word shapes. Changing alphabets spreads those counts across several symbols. For a repeating-key cipher, finding the period lets you separate the alphabets and analyze their frequencies individually.

Updated .

One paragraph, two cipher systems

This is the opening paragraph of Lewis Carroll’s Alice’s Adventures in Wonderland (1865), chapter I. The text is public domain in the USA; read the source paragraph at Project Gutenberg. Line breaks are joined with spaces; punctuation is preserved.

Alice was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do: once or twice she had peeped into the book her sister was reading, but it had no pictures or conversations in it, “and what is the use of a book,” thought Alice “without pictures or conversations?”

For monoalphabetic substitution, enter FREQUENCY as the key above. The tool removes duplicate letters and appends unused A–Z letters, giving FREQUNCYABDGHIJKLMOPSTVWXZ. For Vigenère, use keyword LEMON, repeating-key mode (Autokey off), and preserve case and non-alphabetic characters. Spaces and punctuation do not advance the Vigenère key.

Computed 2026-10-29 with this site’s codecs.

Same 236 A–Z letters in every row; top five letters show counts.
System / keyIndex of coincidenceTop 5 letters (count)Repeated plaintext words
Plaintext0.068338T: 26, E: 25, O: 24, I: 23, N: 2014 repeated word groups (reference)
Monoalphabetic · FREQUENCY0.068338P: 26, U: 25, J: 24, A: 23, I: 2014/14 groups repeat identically
Vigenère · LEMON0.044392S: 19, H: 17, E: 16, R: 16, F: 131/14 groups repeat identically

IoC = Σ fᵢ(fᵢ − 1) / [N(N − 1)], where fᵢ is a letter’s count and N is the number of A–Z letters. Counts ignore case, spaces, and punctuation; IoC is rounded to six decimal places. Ties in the top five are sorted alphabetically. A repeated-word group is one case-insensitive word occurring at least twice; it counts as identical only when every occurrence has the same ciphertext.

Substitution leaves the IoC exactly unchanged because it only relabels the counts. Vigenère lowers it in this sample, but a single paragraph’s IoC is evidence, not a definitive cipher identifier or a security score. The result depends on the text and key; a one-letter Vigenère key is just a Caesar shift.

Full ciphertexts to reproduce the experiment

Monoalphabetic — FREQUENCY

Fgaeu vfo rucaiiaic pj cup tumx pamuq jn oappaic rx yum oaopum ji pyu rfid, fiq jn yftaic ijpyaic pj qj: jieu jm pvaeu oyu yfq kuukuq aipj pyu rjjd yum oaopum vfo mufqaic, rsp ap yfq ij kaepsmuo jm ejitumofpajio ai ap, “fiq vyfp ao pyu sou jn f rjjd,” pyjscyp Fgaeu “vapyjsp kaepsmuo jm ejitumofpajio?”

Vigenère — LEMON

Lpuqr hee prrmzbvyk fc tpx hsej xufro sr gvexubt mc tse dmehrc sz hup fmbx, lrp cs sehwar rahutrs hb os: abpp sd hjtgq gup lmr cpibsq trfc gsi ncbv lqf ftwfse hee frlhubt, myf wg sep bb amohhcie ce nszjrcwmhvzre wa tx, “mbq hlmh vd xts hdi at n msay,” gssguue Exwpp “auhuzyf dvnxgfrd sd qbyzqfflxucad?”

Pattern evidence: what happens to “THE”?

The paragraph contains 3 instances of this word. Positions below start at zero and count only A–Z letters, so they match the Vigenère codec’s key counter. Ciphertext words are shown in uppercase.

THE encrypted in its original paragraph position
Letter indexKey phase (index mod 5)MonoalphabeticVigenère
533PYUHUP
1094PYUGSI
1811PYUXTS

The monoalphabetic word is identical every time. With the five-letter key LEMON, these occurrences start at different key phases and encrypt differently. If the gap between word starts is a multiple of five letters, the same word receives the same key segment and repeats exactly in Vigenère too. For other keywords, shorter effective periods or matching key segments can also create repeats; a different phase does not guarantee a different ciphertext for every word.

To investigate an unknown monoalphabetic key, open the frequency analysis tool, count letters, look for repeated word shapes, and test likely mappings against the whole message. The most common symbol is a clue, not automatically E.

Key space: 26! versus 26ⁿ

A full 26-letter monoalphabetic key alphabet has 26 choices for the first replacement, 25 for the second, and so on: 26! = 26 × 25 × … × 1 ≈ 4.03 × 10²⁶. This counts arbitrary permutations accepted by the tool. Restricting keys to dictionary keywords produces far fewer alphabets, and different keywords can normalize to the same alphabet.

Exact counts, including identity keys and keys with shorter effective periods
SystemFormulaPossible keys
Arbitrary substitution alphabet26!403291461126605635584000000
Vigenère, n = 526^511881376

For a Vigenère key of length n, each position independently allows 26 letters, giving 26ⁿ key strings. With n = 5 as in LEMON, that is 11,881,376. Repeated keys such as AAAAA have shorter effective periods; this is not a count of keys whose shortest period is exactly n.

A huge key space does not prevent frequency analysis. Monoalphabetic substitution leaks letter counts and patterns regardless of how many alphabets are possible. Repeating-key Vigenère also has exploitable structure. For simpler fixed mappings, compare Caesar and Atbash.

How to use this substitution cipher decoder

  1. Select Plain Text to Ciphertext to encode or Ciphertext to Plain Text to decode.
  2. Enter your Substitution Key. The tool uppercases it, removes non-A–Z characters and duplicate letters, then appends unused letters in A–Z order. Check the displayed Normalized key.
  3. Type or paste the message. Output updates automatically, preserving letter case, spaces, numbers, and punctuation. To decode, supply the same forward key alphabet used to encode; the tool reverses it for you.
  4. Open Mapping to inspect the plaintext and substitution alphabets. In Examples, Try This loads the sample text and its key and switches to encoding.
  5. Use Swap to move output into input and toggle encode/decode. Clear Input clears the text; Reset Key restores the keyboard-style default key.
  6. Use Copy or Download to save the output. The download is a plain-text file named substitution-cipher-output.txt.

This is a decoder for a supplied key. For an unknown key, start with frequency analysis, then enter the recovered alphabet here to check the complete plaintext.

Free Online Tool

This tool is useful for classical cryptography practice, escape-room design, and testing keyed alphabet mappings.

How It Works

A substitution cipher replaces each plaintext letter with a corresponding ciphertext letter from a fixed key alphabet. If A maps to Q, every A in the message becomes Q during encryption.

To decode the message, you reverse that mapping. This tool normalizes your key so it always becomes a complete 26-letter alphabet, even if you paste a partial or messy input.

Unlike polyalphabetic ciphers such as Vigenère, a monoalphabetic substitution cipher uses the same mapping for the entire message. That consistency makes it easy to use but also easy to attack with frequency analysis.

To see the same letter patterns in pictures, try the emoji encoder and decoder, which substitutes emoji for letters and includes a worked frequency-analysis example.

Examples

Atbash-style reversed alphabet

Key

ZYXWVUTSRQPONMLKJIHGFEDCBA

HELLO becomes SVOOL

Keyboard-style key

Key

QWERTYUIOPASDFGHJKLZXCVBNM

HELLO becomes ITSSG

History and Use Cases

Monoalphabetic substitution is one of the oldest practical cipher families. It appears in many historical systems because it is simple to apply by hand and easy to describe with a single keyed alphabet.

In the ninth century, al-Kindi described breaking substitution ciphers by comparing letter frequencies in his treatise on deciphering cryptographic messages. His account is an early documented foundation of frequency analysis. Source: al-Kindi’s cryptography.

In 1467, Leon Battista Alberti described an early polyalphabetic system using two concentric cipher disks. Rotating a disk during a message changed the alphabet alignment, so the substitution did not stay fixed. This was a different mechanism from the repeating keyword used by Vigenère in our experiment. Source: Alberti cipher.

Today, substitution ciphers are used mainly for teaching, puzzles, puzzlehunt design, and introductory cryptanalysis exercises. They are not suitable for real confidentiality because repeated letters and common word shapes leak too much information.

Why It Matters

Training

Great for practicing manual encryption, decryption, and frequency-based attacks.

Education

Helps explain the difference between simple substitution, transposition, and stronger modern ciphers.

Puzzle Design

Useful for creating custom encoded clues with a bespoke alphabet rather than a fixed Caesar shift.

Substitution Cipher FAQ

What is a monoalphabetic substitution cipher?

A monoalphabetic substitution cipher uses one fixed alphabet mapping for the whole message. Each plaintext letter always becomes the same ciphertext letter. In simple substitution, the key is a permutation of the alphabet, so each ciphertext letter also has exactly one plaintext partner.

How do you decode a monoalphabetic substitution cipher?

If you know the key alphabet, select Ciphertext to Plain Text on this page, enter that same alphabet in Substitution Key, and paste the ciphertext. The tool reverses the mapping automatically. If the key is unknown, use the frequency analysis tool to compare letter counts and repeated-word patterns, refine a proposed mapping, and then test the recovered key here. This decoder applies a supplied key; it does not solve an unknown key automatically.

What is the difference between monoalphabetic and polyalphabetic ciphers?

Monoalphabetic ciphers keep one mapping for the entire message, preserving letter-frequency counts under different labels and repeated-word patterns. Polyalphabetic ciphers such as Vigenère and Porta change mappings with the key position. With a repeating key, words at the same key phase still encrypt identically; splitting the ciphertext by the key period can expose frequency patterns again.

Are Caesar and Atbash monoalphabetic ciphers?

Yes. Caesar shifts every letter by one fixed amount, and Atbash uses one fixed reversed alphabet (A to Z, B to Y, and so on). Both keep the same substitution throughout the message. A general monoalphabetic substitution key can be any alphabet permutation, rather than only a uniform shift or reversal.

Is Playfair a monoalphabetic cipher?

Playfair is a digraphic (polygraphic) substitution cipher: it encrypts pairs of letters using a fixed key square. A single letter can encrypt differently depending on its partner, so Playfair is not a simple monoalphabetic letter substitution like Caesar or Atbash. Its fixed mapping of prepared digraphs also differs from the position-dependent alphabets of Vigenère; classify it as digraphic substitution.

Can a substitution cipher be brute-forced, and is it secure?

Exhaustive search is possible in principle, but a general 26-letter substitution has 26! = 403291461126605635584000000 possible alphabets (about 4.03 × 10^26), making a full search impractical. That large key space does not make it secure: frequency analysis, word patterns, and known plaintext can recover a key without trying every permutation. These ciphers suit puzzles and education, not modern confidentiality. Restricting keys to dictionary keywords gives a much smaller search space.