Cryptarithm solver

Type a cryptarithm such as SEND + MORE = MONEY and the solver finds every solution, counts them, and shows the working column by column with each carry.

Classic puzzles

Letters, +, -, * (times) and one =. Each letter is one digit, different letters are different digits.

Solutions

How to use the cryptarithm solver

A cryptarithm, also called an alphametic, is a sum written in words where every letter stands for a digit. This cryptarithm solver finds every solution of your puzzle: type it as you see it, for example SEND + MORE = MONEY, and press Solve. You can add more than two words (FORTY + TEN + TEN = SIXTY), subtract (COUNT - COIN = SNUB) or multiply (ABC * DE = FGHIJ; type * or × for times). Upper or lower case and spaces do not matter.

The rules the solver follows are the usual ones: each letter is one digit, different letters are different digits, and a word of two or more letters never starts with 0. If your puzzle allows leading zeros, tick Allow a word to start with 0. The base can be changed from 10 to anything from 2 to 16 for puzzles written in binary, octal or hexadecimal; digits above 9 are shown as A to F.

Reading the answer

The result says how many solutions exist, and the count is complete: the solver tries every possible digit assignment, so "exactly 1 solution" means the puzzle is well made, and "no solution" means no assignment works at all. A good alphametic has exactly one answer. You get the equation with numbers, the digit of every letter, the sum written in columns, and the reasoning column by column from the units, with each carry. For subtraction the puzzle is turned around into an addition (COUNT - COIN = SNUB is the same as COIN + SNUB = COUNT), and products are shown as a long multiplication with one partial product per digit. When there are several solutions, tap any of them in the list to see its working.

Worked example: SEND + MORE = MONEY

This is the best known alphametic, first published by Henry Dudeney in 1924. Its only answer is 9567 + 1085 = 10652. The reasoning in short: two four-digit numbers add up to less than 20,000, so the carry into the fifth column is 1 and M = 1. Then S + 1, plus any carry, must reach 10 or more, so O = 0 (O cannot be 1, which M already is) and S is 8 or 9; the other columns rule out 8. Column by column from the units, as the solver shows it:

  1. Units: D + E = 7 + 5 = 12, so Y = 2, carry 1.
  2. Tens: N + R + 1 = 6 + 8 + 1 = 15, so E = 5, carry 1.
  3. Hundreds: E + O + 1 = 5 + 0 + 1 = 6, so N = 6.
  4. Thousands: S + M = 9 + 1 = 10, so O = 0, carry 1.
  5. Ten-thousands: only the carry is left, so M = 1.

Other classics to try: TWO + TWO = FOUR has 7 solutions (734 + 734 = 1468 is one of them), DONALD + GERALD = ROBERT has one (526485 + 197485 = 723970), and CROSS + ROADS = DANGER has one (96233 + 62513 = 158746).

How the solver works

Trying all digit assignments one by one could mean millions of cases for a ten-letter puzzle. The solver works like a person with pencil and paper instead: it starts with the units column, gives digits only to the letters in that column, and checks the column straight away. In a sum the column total must end in the right digit; in a product the last digits of the result depend only on the last digits of the factors. A wrong choice is thrown out at once, together with every assignment that would have followed it, before the solver moves one column to the left. That is why the classic puzzles above take from a few dozen to a few tens of thousands of steps rather than millions. Every solution found is then checked again with exact whole-number arithmetic before it is shown.

Our test suite compares the solver against a plain brute force that tries every assignment, on the classic puzzles above and on dozens of random puzzles made from real sums, differences and products, and requires the same number of solutions every time.

For arithmetic with plain numbers, the 24 game solver finds every way to reach 24; for letters that stand for other letters, use the cryptogram solver.

Solver tested . Found a problem? Tell us.

Questions

What is the answer to SEND + MORE = MONEY?

9567 + 1085 = 10652, so S = 9, E = 5, N = 6, D = 7, M = 1, O = 0, R = 8 and Y = 2. It is the only solution when no number may start with 0.

What is the difference between a cryptarithm and an alphametic?

A cryptarithm is any arithmetic puzzle with hidden digits, written with letters or symbols. An alphametic is the kind where the letters spell real words, like SEND + MORE = MONEY. This solver handles both, as long as each letter stands for one digit.

Can two letters have the same digit?

No. In the standard rules different letters are different digits and the same letter is always the same digit. With 10 digits, a puzzle can therefore use at most 10 different letters in base 10.

Why does my puzzle have no solution?

The solver checked every possible assignment and none works. Usually a word is misspelled or a letter is missing. Some puzzles are only solvable if a word may start with 0; tick that option to check.

How many solutions does TWO + TWO = FOUR have?

Seven, when no number starts with 0. One of them is 734 + 734 = 1468. Press the TWO + TWO = FOUR example to see all seven.

Does it solve multiplication cryptarithms?

Yes, a product of two or more words equal to one word, such as HE * HE = SHE (25 × 25 = 625). Mixed puzzles with both + and * in one equation are not supported.