Homophonic Cipher Decoder & Encoder

Encode and decode one-to-many substitution ciphers with the 100-code table, a random table or your own, and analyze a ciphertext to see whether it is homophonic.

By · Updated

How to use the homophonic cipher tool

Encode, decode and solve by hand

  1. Enter plaintext and keep the default table, click Random for a new 100-code table, or click Use my own table and type one letter per line (E: 18 19 20).
  2. Choose Encode. With Random code choice each letter takes one of its codes at random; with In order it uses its codes one after another, so the result is repeatable.
  3. For Decode, paste space-separated codes and use the same table that encoded them.
  4. To check an unknown ciphertext, paste it into the Analyze tab: it counts the symbols, measures how flat they are and shows how much the current table decodes.
  5. No table? Use the hand-solving box under Analyze (an in-place solver): type guesses such as 18=E, 42=I and the partial plaintext fills in as you go.

Frequent letters receive more possible codes to flatten symbol frequencies. The example outputs on this page come from single random encodes, so your own run may give different codes.

TL;DR: homophonic cipher in brief

  • A homophonic cipher gives each letter several possible symbols, with more symbols for common letters.
  • The goal is to flatten letter frequencies so simple frequency counting no longer reveals the plaintext.
  • Here the default symbols are the 100 two-digit codes 00–99, each belonging to exactly one letter; you can also use your own table.
  • Measured on 6,534 letters of the Declaration of Independence, the most common symbol drops from 13.1% (simple substitution) to 1.5% (homophonic).
  • It is a classical cipher for learning and puzzles, not for protecting real secrets.

The default code table

This is the table the tool uses by default. It spends all 100 two-digit codes: the more common a letter is in English, the more codes it gets. The last column shows the share of all ciphertext symbols one code of that letter should take on average, which is the letter's English frequency divided by its number of codes.

English frequencies are from Lewand's Cryptological Mathematics, as tabulated on Wikipedia.
LetterCodesCountEnglish frequencyPer code
A01 02 03 04 05 06 07 0888.2%1.02%
B09 1021.5%0.75%
C11 12 1332.8%0.93%
D14 15 16 1744.3%1.07%
E18 19 20 21 22 23 24 25 26 27 28 291212.7%1.06%
F30 3122.2%1.10%
G32 3322%1.00%
H34 35 36 37 38 3966.1%1.02%
I40 41 42 43 4457%1.40%
J4710.16%0.16%
K4810.77%0.77%
L49 50 51 5244%1.00%
M53 5422.4%1.20%
N55 56 57 58 59 6066.7%1.12%
O61 62 63 64 65 66 67 6887.5%0.94%
P69 7021.9%0.95%
Q7110.12%0.12%
R72 73 74 75 76 7766%1.00%
S78 79 80 81 82 8366.3%1.05%
T84 85 86 87 88 89 90 91 9299.1%1.01%
U93 94 9532.8%0.93%
V9610.98%0.98%
W97 9822.4%1.20%
X9910.15%0.15%
Y00 4522%1.00%
Z4610.074%0.07%

Worked example: encoding HELLO with the homophonic table

To encode HELLO with the default table, pick one code for each letter: H has 6 choices, E has 12, each L has 4 and O has 8. Two valid results are:

34 19 52 52 67 decodes to HELLO

37 23 49 50 65 decodes to HELLO

The two L's in the first version use the same code (52), and in the second they use different ones (49 and 50). A repeated letter does not have to repeat its code. Multiplying the choices gives 6 × 12 × 4 × 4 × 8 = 9,216 different ways to write HELLO, and every one decodes back to HELLO. TEST has 9 × 12 × 6 × 9 = 5,832.

To decode, look each code up in the table: 34 is H, 19 is E, 52 is L and 67 is O. Because every code belongs to one letter, decoding needs no guessing; the randomness only exists when encoding.

Measured: how much a homophonic cipher flattens frequencies

We encrypted the first 100, 500 and 2,000 letters and then all 6,534 letters of the Declaration of Independence two ways and counted the ciphertext symbols. A simple substitution only renames letters, so its symbol counts are the letter counts. The homophonic version uses this tool's default 100-code table with random code choice (fixed seed 1, so the numbers can be reproduced). The text is the Declaration transcription this site also uses for the Beale cipher; only the letters A–Z are counted, after removing spaces, punctuation and case. Another seed or another text gives slightly different numbers, but the same pattern.

Measured November 4, 2026 with this tool's own code. IoC = index of coincidence = Σ n(n−1) / (N(N−1)), where n is the count of each symbol and N the total: the chance that two symbols picked at random are the same.
LettersSimple: symbolsSimple: top symbolSimple: IoCHomophonic: symbolsHomophonic: top symbolHomophonic: IoC
10020E · 16.0%0.06716418 · 5.0%0.0103
50023E · 15.6%0.07499738 · 2.4%0.0104
2,00026E · 13.7%0.069510078 · 1.8%0.0106
6,53426E · 13.1%0.068210042 · 1.5%0.0105
  • The simple substitution keeps E on top at every length (13.1% of the full text) and an IoC near 0.068, the English fingerprint a solver looks for first.
  • The homophonic ciphertext stays near an IoC of 0.011, close to the 0.010 of a perfectly flat 100-symbol text, and its top symbol takes only 1.5%. In the full text that top code is 42, one of I's five codes, not an E code.
  • With 100 letters only 64 of the 100 codes appear at all; all 100 show up by 2,000 letters. Short homophonic messages therefore look even more random than long ones.

The rare letters are where the table cannot hide anything. Each has one code, so in the full text its code appears exactly as often as the letter:

LetterIts only codeTimes in 6,534 lettersShare of ciphertext
J47160.24%
K48140.21%
Q7160.09%
V96741.13%
X9990.14%
Z4640.06%

Against an average of 1% per code, the codes of J, K, Q, X and Z each appear less than a quarter as often, which marks them as rare letters. V is the exception: at 74 occurrences its single code 96 is slightly above 1%. You can reproduce the first 200 letters of this test in the tool: load the sample into Analyze.

How to recognize a homophonic ciphertext

  • More than 26 different symbols. A simple substitution of English cannot use more than 26. Two-digit numbers, or a mix of letters, digits and drawn symbols well past 26, are the classic sign.
  • A flat distribution. Ordinary English letters give an index of coincidence of about 0.066; in our test a 100-code homophonic ciphertext gave about 0.011. No single symbol dominates the way E does.
  • A few very rare symbols. Letters like Q, X and Z usually keep one symbol, so a handful of symbols appear far less often than the rest.
  • Not Vigenère. A Vigenère ciphertext also looks flat, but it uses only the 26 letters and shows repeats at a regular key spacing; try the Kasiski walkthrough or the frequency analysis tool if the symbols are letters.

The Analyze tab in the tool checks the first three points for you. Fewer than about 50 symbols is too short to judge, because a short message can look flat by chance.

How to solve a homophonic cipher without the table

Counting single symbols does not work, as the measured table shows. Solvers instead attack what the cipher does not hide:

  1. Group the codes. Codes of the same letter tend to appear in the same places, before and after the same neighbours. A code often followed by the same few codes may be one of the H or E group in TH and HE.
  2. Use a crib. A word you expect in the message (a name, a date, THE) fixes several codes at once. According to Wikipedia, the Zodiac 408 cipher was solved in 1969 by Donald and Bettye Harden, who guessed that the killer would write about himself and use the word KILL.
  3. Let a computer search. Programs such as AZdecrypt start from a random table, change one code at a time and keep changes that make the decryption look more like the language, measured with letter-group (n-gram) statistics. Research solvers use the same idea with beam search (Nuhn, Schamper and Ney, EMNLP 2014).

Length matters: a few hundred symbols with many codes per letter may have more than one plausible solution, while thousands of symbols usually have only one. This tool decodes with a table you have and analyzes a ciphertext. For steps 1 and 2 the Analyze tab has a hand-solving box: assign letters to symbols (18=E) and every occurrence fills in, so you can test a crib. It does not run step 3, an automatic search.

Zodiac facts: Wikipedia: Zodiac Killer.

Weaknesses of the homophonic cipher: why it still leaves clues

With enough codes, the common letters spread out: in the table above, each code of E, T, A, O, S, N, R and H takes roughly 1% of the ciphertext, close to the 1% a perfectly flat distribution would give. That is the point of the cipher, and it defeats a simple count of which symbol appears most.

It cannot flatten everything with only 100 codes. The rare letters J, K, Q, V, X and Z each keep a single code, so their codes are expected to show up only about 0.07% to 0.98% of the time, at or below the 1% average (in the measured text above, V's single code reached 1.13%). A code that is rarely seen is a clue that it stands for an uncommon letter. Some letters also end up above the average: with five codes, each I code takes about 1.40%.

Beyond single letters, homophonic ciphers keep the structure of the language. Letters still follow one another in typical pairs and patterns, and a solver can use that, with a computer, to test many possible tables. Programs such as AZdecrypt do this routinely (see the solving section above), so a homophonic cipher is a good puzzle rather than a safe way to hide a message.

Homophonic cipher history and where you will meet one

  • 1401: Francesco I Gonzaga, Duke of Mantua, used the earliest known example of a homophonic substitution cipher, in correspondence with Simone da Crema ( Wikipedia: Substitution cipher).
  • 1578–1584: Mary, Queen of Scots used homophonic ciphers, with a nomenclator for frequent prefixes, suffixes and names, while imprisoned by Elizabeth I (same source).
  • 1885: The Beale ciphers, a set of three numeric ciphertexts, are a homophonic type in which each number stands for one letter, keyed to a text; the solved one used the Declaration of Independence (same source).
  • 2020: After 51 years, the Zodiac Killer's 340-character cipher was solved by David Oranchak, Sam Blake and Jarl Van Eycke. It used 63 different symbols for the letters, and its symbols had also been rearranged, so the solvers tried hundreds of thousands of rearrangements with the AZdecrypt program ( Cryptologic Foundation).
  • Today: you are most likely to meet a homophonic cipher in puzzle books, escape-room and capture-the-flag challenges, and classroom cryptography exercises, and in the short Zodiac ciphers that are still unsolved.

What this tool does and does not do

  • It encodes the letters A–Z. Spaces are kept, and other characters are passed through unchanged.
  • Codes are separated by spaces. When decoding, an unknown number shows as ? and any other token is passed through. Decoding does not restore the spaces between words, so ZYZ HELLO comes back as ZYZHELLO.
  • Random builds a new table from all 100 codes, with every letter getting at least one, and more for common letters. Keep the table (the download includes it) or you cannot decode the result later.
  • Use my own table accepts one letter per line (A: 01 02 03). Codes may be numbers of any length or other symbols; a code given to two letters is rejected, and letters with no code encode as ??.
  • Analyze counts symbols and decodes with the current table. Without the table you can solve by hand: type guesses such as 18=E and the preview fills them in. It does not search for an unknown table automatically.
  • Processing happens in your browser and nothing is uploaded. The output is not secure encryption.

Homophonic cipher examples

Both are real outputs of one random encode; the tool picks among valid codes, so your run may differ.

Default table, one sampled encode — input:

HELLO

Output:

34 19 52 52 67

Default table, one sampled encode — input:

TEST

Output:

88 24 78 89

Frequently Asked Questions

What is a homophonic substitution cipher?

A homophonic substitution cipher replaces each plaintext letter with one of several possible symbols. Common letters get more symbols than rare ones, which flattens the letter frequencies that a simple substitution cipher leaves visible.

How is it different from a simple substitution cipher?

A simple substitution gives each letter exactly one symbol, so it can use at most 26 symbols and keeps every letter's frequency. A homophonic cipher gives letters several symbols, so it uses more than 26 and spreads the common letters out. In our test on the Declaration of Independence, the most common symbol fell from 13.1% of the text (E, simple substitution) to 1.5% (one code, homophonic).

How many codes does each letter get in this tool?

The default table uses all 100 two-digit codes, 00 to 99. E has 12, T has 9, A and O have 8 each, and J, K, Q, V, X and Z have one each (Y has two). You can also generate a random table that uses all 100 codes, or type your own.

Can I use my own substitution table?

Yes. Click Use my own table, write one letter per line such as E: 18 19 20, and click Apply table. Codes can be numbers of any length or other symbols, but each code may belong to only one letter, otherwise it could not be decoded. The download saves the output together with the table in the same format.

Why does the same word encode differently each time?

With Random code choice, each letter picks one of its codes at random, so HELLO can be written in 9,216 different ways with the default table (6 x 12 x 4 x 4 x 8). Every version decodes back to HELLO. Choose In order if you want the same text to give the same output every time.

How do I decode a homophonic cipher?

Switch to Decode, paste the codes separated by spaces, and use the same table that encoded them. Each code belongs to exactly one letter, so decoding is a direct lookup. Unknown numbers show as ?.

How can I tell if a ciphertext is homophonic?

Count the different symbols. English written with a simple substitution can use at most 26, so a ciphertext with clearly more than 26 symbols and a flat distribution (an index of coincidence near 0.01 instead of about 0.066 for English letters) points to a homophonic cipher. The Analyze tab measures both.

Can a homophonic cipher be solved without the table?

Often, yes, but not by counting single symbols. Solvers use the structure that survives: common letter pairs and triples, guessed words (cribs), and the rare codes that appear far less often than the others. Computer programs try many tables and keep the ones whose decryption looks most like the language. This tool has no automatic solver, but its Analyze tab lets you solve by hand: assign letters to symbols (18=E) and watch the plaintext fill in.

Is a homophonic cipher secure?

No. It is a classical cipher. It makes single-letter frequency analysis harder, but patterns remain, and modern solvers break long homophonic ciphertexts with computer search. Do not use it to protect real secrets.

Were the Zodiac ciphers homophonic?

Yes. The Zodiac Killer's 408-symbol cipher was a homophonic substitution and was solved in 1969 by Donald and Bettye Harden. The 340-symbol cipher used 63 different symbols and was also transposed; it was solved in 2020 by David Oranchak, Sam Blake and Jarl Van Eycke.

Why do 100 codes not flatten every letter?

Rare letters still need at least one code each, and a single code cannot be shared without breaking decoding. In the default table J, K, Q, V, X and Z each have one code, so those codes appear much less often than 1%, while each of I's five codes appears more often. In our full Declaration test the most common code was 42, one of I's codes, not an E code.

Features

Privacy Focused

All processing happens in your browser. No data is sent to servers.

Free Forever

No registration, no limits, completely free to use.