Homophonic Substitution Cipher
Type a message to encode it with a simplified homophonic substitution cipher.
Result
How it is calculated
The text is converted to upper case and only the letters A to Z are encoded; spaces, digits, punctuation and accented letters are skipped and not counted. For each letter, take its index i (A = 0 … Z = 25) and its position p among the letters (first letter = 0). The code is (3 × i + p) mod 99, written with two digits and separated by spaces.
Because the position is part of the formula, the same letter gets a different code each time it appears, which is the many-to-one idea behind homophonic ciphers. Unlike a real homophonic cipher with a fixed table of alternatives, the code here is a simple rule, and it is reproducible: the same message always gives the same output. Codes wrap around after 98 (the next one is 00). This is a teaching demo only, with no key and no decoder, and it must not be used to protect anything.
Worked example
Encode HELLO. The letters have indexes H = 7, E = 4, L = 11, L = 11, O = 14, at positions 0 to 4. H: 3 × 7 + 0 = 21. E: 3 × 4 + 1 = 13. First L: 3 × 11 + 2 = 35. Second L: 3 × 11 + 3 = 36. O: 3 × 14 + 4 = 46. The tool outputs 21 13 35 36 46 and reports 5 letters. Note that the two Ls became different codes, 35 and 36, even though they are the same letter.
Common mistakes
- Expecting a decoder or a secret key. The tool only encodes with a fixed rule; anyone who knows the rule can reverse it, so it offers no security.
- Counting spaces and punctuation as letters. Only A to Z are encoded, so 'Hello, World' gives 10 codes, not 12.
- Typing accented or non-Latin letters such as ş, ğ or ü. They are ignored; a text with no A to Z letters gives no result.
- Assuming the same letter always gets the same code, as in a plain substitution cipher. Here it depends on the letter's position in the message.
- Thinking this is how historical homophonic ciphers worked. Real ones used a table with several symbols per common letter; this is a simplified position-based demo.
About this calculator
A homophonic substitution cipher improves on a plain substitution cipher (where each letter always maps to the same symbol) by giving common letters several interchangeable codes instead of just one. Because a letter like “e” might be replaced by any of several different 2-digit numbers depending on where it appears, the resulting ciphertext has a flatter, more uniform distribution of symbols, which defeats simple frequency analysis — the classic technique of counting symbol frequency to guess which cipher-symbol represents “e”, “t”, and so on.
Historical nomenclators and “great ciphers” used by diplomats and spies from the Renaissance through the 19th century (and famously the unsolved Zodiac Killer’s 340-character cipher) relied on this same many-to-one idea. This tool is an educational demonstration: type a message and it encodes each letter into a 2-digit code that shifts with position, letting you see how homophonic substitution scrambles letter frequency compared to a simple one-to-one cipher.
Was this helpful?
You can pick up to 3 reactions.
Popular calculators
Loan Calculator
Monthly payment, total interest and full amortization schedule.
Percentage Calculator
Percent change, percent of, and ratio calculations.
Discount Calculator
Calculate final price, savings, and discount amount.
BMI Calculator
Body mass index from height and weight (metric or imperial).
Age Calculator
Compute your exact age in years, months and days from a birth date.
Compound Interest Calculator
Calculate the final amount and interest earned with compounding.
All Calculators
- Loan Calculator
- Profit Calculator
- Discount Calculator
- BMI Calculator
- Percentage Calculator
- Ideal Weight Calculator
- Age Calculator
- Pregnancy Due Date Calculator
- Compound Interest Calculator
- BMR Calculator (Basal Metabolic Rate)
- Tip Calculator
- Fuel Cost Calculator
- Date Difference Calculator
- Sleep Cycle Calculator
- Daily Water Intake Calculator
- Simple Interest Calculator
- Heart Rate Zones Calculator
- Running Pace Calculator
- Pet Age Calculator
- Calories Burned Calculator
- Macro Calculator
- TDEE Calculator (Total Daily Energy Expenditure)
- Waist-to-Hip Ratio Calculator
- Honor Roll Calculator
- One Rep Max (1RM) Calculator
- Ovulation Calculator
- Electricity Cost Calculator
- Unit Price Calculator
- Savings Goal Calculator
- Break-Even Point Calculator
- Paint Calculator
- Course Grade Average Calculator
- Business Days Calculator
- Time Duration Calculator
- Fuel Economy Calculator
- Temperature Converter
- Tile Calculator
- Aspect Ratio Calculator
- Roman Numeral Converter
- Goal Weight Timeline Calculator
- Salary Converter (Hourly to Annual)
- Credit Card Validator (Luhn)
- Body Surface Area (BSA) Calculator
- Feels-Like Temperature Calculator
- Ohm’s Law Calculator
- PPI (Pixel Density) Calculator
- Molar Mass Calculator
- Zodiac Sign Calculator (Western + Chinese)
- IBAN Validator
- Shoe Size Converter
- Country Info & Dialing Code Lookup
- Time Zone Difference (World Clock)
- CAGR (Compound Annual Growth Rate) Calculator
- Rule of 72 Calculator
- Blood Alcohol Content (BAC) Calculator
- Lean Body Mass (LBM) Calculator
- Pythagorean Theorem Calculator
- Speed Converter
- Download Time Calculator
- Date Calculator (Add/Subtract)
No calculators found
Comments (1)
Use this for puzzles and classroom demos, not secrecy. You can check an output by hand: HELLO gives 21 13 35 36 46, and the two L's become 35 and 36 because each code is three times the letter index plus its position, wrapped at 99. The second L being one higher than the first shows that position is built in. What are you using the codes for: a puzzle, a lesson, or a game?