Home › Ciphers › Cryptarithm Solver

Cryptarithm Solver

A cryptarithm hides an arithmetic sum behind letters: each letter is a digit, different letters are different digits, and the words must add up. SEND + MORE = MONEY is the famous one — a real sum wearing a sentence as a disguise. This solver does not guess: it walks the sum column by column, carry by carry, and keeps going until it has found every solution or proved there are none. When it says “unique”, that is a proof, not an impression.

In short

A cryptarithm (or alphametic) is an arithmetic equation in which letters stand for digits: the same letter always means the same digit, different letters mean different digits, and no multi-letter word may begin with zero. The solver below parses your puzzle, searches it exhaustively by columns and carries, and lists all solutions — up to a stated cap of 1,000 — together with the size of the search it actually performed.

Supports addition and subtraction (MONEY − MORE = SEND works), any number of addends, and reports “no solution” only when the completed search proves it.

Solve your cryptarithm

Try a classic:

Everything runs in your browser — nothing is uploaded.

How it works

The rules, and a search that respects them

Three rules define the game. One letter, one digit — everywhere in the puzzle. Different letters, different digits — the mapping is a genuine code, not a many-to-one squash. No leading zeros — a multi-letter word cannot begin with the digit 0, because nobody writes numbers that way. A puzzle can use at most ten distinct letters, for the arithmetical reason that there are only ten digits. Within those rules a classic like SEND + MORE = MONEY has exactly one assignment that works — and the interest of the puzzle is that the rules plus the carries force it, step by step, with no guessing.

How the solver searches

The naive way to solve a cryptarithm is to try digit assignments letter by letter: for SEND's eight letters that is up to 10 × 9 × … × 3 = 1,814,400 assignments, each checked against the whole sum. This solver instead works the way the arithmetic does — from the units column leftwards. A column only involves the few letters standing in it, so the search assigns just those, checks that the column's total (with the carry in) produces the result digit and the right carry out, and only then moves left. A wrong digit is usually caught in the first column it touches, so whole continents of the assignment space are pruned unvisited. The search is a depth-first walk with a node counter, and the counter is printed with every answer: SEND + MORE = MONEY is settled in 8,650 nodes, DONALD + GERALD = ROBERT — a ten-letter puzzle, 3,628,800 raw assignments — in 5,407. Because the walk is exhaustive, “one solution” means the walk finished and found one, and “no solution” means it finished and found none. Both are proofs.

The honesty notes

  • Time grows with freedom. Puzzles whose columns constrain weakly — many letters appearing once, in the last column touched — can visit very large numbers of nodes. The tool reports the count it reaches rather than hiding it.
  • Solutions are capped at 1,000. Loose puzzles (A + B = C) have dozens of solutions; near-empty ones can have thousands. Past the cap the tool says so, rather than pretending the list is complete.
  • Subtraction is supported on the left-hand side, as a negative addend — MONEY − MORE = SEND returns the same classic assignment, read backwards.
Origin & history

Dudeney's advertisement for arithmetic

The most famous cryptarithm ever set appeared in the July 1924 issue of Strand Magazine, in Henry Ernest Dudeney's puzzle column: SEND + MORE = MONEY, a sum that reads as its own instructions — send more money. Dudeney called such puzzles verbal arithmetic. In the 1950s the Toronto mathematician J. A. H. Hunter gave them the name they now travel under — alphametics — and wrote the books that made them a genre: puzzles built on names (DONALD + GERALD = ROBERT), on proverbs, on anything whose words could be made to add up. The genre's etiquette hardened into the three rules above, and its classics are still set, solved and argued over in puzzle columns today — now with the difference that a column-by-column search can certify in milliseconds what a 1924 reader proved with an evening of pencil work.

  • 1924 — Dudeney publishes SEND + MORE = MONEY in Strand Magazine.
  • 1950s — J. A. H. Hunter coins “alphametic” and popularises the form.
  • Today — the classics are benchmark puzzles for exact search: small enough to prove, rich enough to be interesting.
Reference

Four classics, certified by the search above

Each of these was re-solved with this page's engine during the build; the node counts are the engine's own, and each solution is the only one the exhaustive search finds.

PuzzleThe sumSolutionsSearch nodes
SEND + MORE = MONEY9567 + 1085 = 1065218,650
DONALD + GERALD = ROBERT526485 + 197485 = 72397015,407
CROSS + ROADS = DANGER96233 + 62513 = 15874619,283
FORTY + TEN + TEN = SIXTY29786 + 850 + 850 = 3148617,744

Read the node column as the shape of each puzzle: DONALD's ten letters look like the biggest search and are the smallest, because its repeated letters (D, O, R, A, L across three long words) tie the columns together early. Raw letter count is a poor guide to difficulty; constraint is everything.

Worked example

SEND + MORE = MONEY, deduced by hand

The puzzle

SEND + MORE = MONEY

Step 1 — M is 1. Adding two four-digit numbers can only reach five digits by a final carry, and a carry is never more than 1. The first letter of MONEY is that carry: M = 1.

Step 2 — O is 0. In the thousands column, S + M + (carry in) must equal O with the final carry M in front: S + 1 + carry = 10 + O. The left side is at most 9 + 1 + 1 = 11, so O is 0 or 1 — and 1 is taken. O = 0, which forces S + carry = 9.

Step 3 — the hundreds column kills a branch. The hundreds column reads E + O + carry = N (possibly with a carry out). With O = 0: if there were a carry out, N would be E + carry − 10, which needs E = 9 and gives N = 0 — taken. So there is no carry out, the carry into the thousands column is 0, and Step 2 gives S = 9, with N = E + carry-in.

Step 4 — N is E + 1, and R is 8. In the tens column, N + R + carry = E or E + 10. If there were no carry out, N would be at most E — but Step 3 says N is E or E + 1, and N ≠ E, so there is a carry out, the carry into hundreds is 1, and N = E + 1. The tens column then reads R = 9 − (carry from units); R cannot be 9 (S has it), so the units column carries and R = 8.

Step 5 — a five-way split, one survivor. N = E + 1 leaves five possible pairs — (E, N) = (2, 3), (3, 4), (4, 5), (5, 6), (6, 7) — and the units column D + E = Y + 10 must be satisfied with the digits left over ({2–7} minus the pair). Four pairs strand D on a digit already spent; only E = 5, N = 6 leaves room, with Y = 2 and D = 7.

Solved: SEND = 9567, MORE = 1085, MONEY = 10652 — 9567 + 1085 = 10652. No step guessed: each was forced by the column it stood in. The tool above reaches the same answer by walking those columns mechanically, and its exhaustive walk is what licenses the word “only”: no other assignment exists.

Limits

Where exhaustive search runs out of road

Exhaustive means exhaustive: the search's guarantee is total, but its cost is not bounded by anything comforting. A puzzle with ten distinct letters and weak column structure can force the walk into millions of nodes; a puzzle whose result is much longer than its addends can be impossible for length reasons the search still has to discover the slow way. The tool's defences are honesty mechanisms, not magic: it counts its nodes, caps its solution list at 1,000 and says when the cap is hit, and a “no solution” verdict is only ever printed after the walk has finished. If a puzzle is still running, it is still running — the count on screen is the truth about how far it has got.

  • More than 10 distinct letters — rejected before the search starts; no assignment can exist.
  • Leading zeros — forbidden for multi-letter words, by the genre's rules; a puzzle that “works” only with MORE = 085 is not solved, it is mis-set.
  • Many-solution puzzles — A + B = C and its kin are listed up to the cap; the count shown is a floor, labelled as such.
Variants

The wider verbal-arithmetic family

VariantWhat changesEffect on solving
AlphameticThe words form a meaningful phrase (SEND MORE MONEY)None — the phrase is the setter's art, the search is identical
SubtractionA term is subtracted (MONEY − MORE = SEND)The column search handles signs directly; borrowing is a negative carry
Doubly-trueThe words are number-names and the phrase is true read aloud (ONE + ONE = TWO… with the reading also correct)Far more constrained; usually unique by construction
Cryptarithm (strict sense)Symbols or arbitrary letters, no phrase requiredThe original name for the whole family — this page's title honours it

Multiplication and division alphametics exist too; they are outside this tool's grammar (one equals sign, + and − on the left) and outside this page's promises.

Uses & culture

A century of pencil arithmetic

Cryptarithms survive because they are the rare puzzle that is also a proof exercise: the solver is not pattern-matching but deducing, and a finished solution carries its own verification — add the numbers and see. Teachers use them to make place value and carrying tangible; puzzle columns use them because a good one (a real phrase, a unique solution) is a small work of craft; and computer science uses them as the friendliest possible introduction to constraint search — the column walk above is backtracking with pruning, wearing a 1924 costume. The classics in the table are the genre's canon: if you set one puzzle for a friend, set SEND + MORE = MONEY, and watch Step 1 land.

Practice

Two to try — and one trap

Practice 1 — CROSS + ROADS = DANGER

CROSS + ROADS = DANGER
Reveal the answer

96233 + 62513 = 158746 — the search's only solution (9,283 nodes). Hand start: the units column S + S = R or R + 10 makes R even, and the double S is the setter's fingerprint.

Practice 2 — FORTY + TEN + TEN = SIXTY

FORTY + TEN + TEN = SIXTY
Reveal the answer

29786 + 850 + 850 = 31486 — again unique (7,744 nodes). Three addends mean carries can reach 2, which is what makes the tens column interesting.

The trap — AA + BB = CCC

AA + BB = CCC
Reveal the answer

There is none — and you can prove it faster than the computer: AA + BB = 11 × (A + B) and CCC = 111 × C, so the puzzle demands 11 × (A + B) = 111 × C; but 111 × C is never divisible by 11 for C = 1…9, so no assignment exists. The tool's exhaustive walk reaches the same verdict the slow way, which is rather the point of the trap.

FAQ

Frequently asked questions

How do I know a solution is really the only one?

Because the search is exhaustive: it walks every column assignment the rules allow, pruning only branches a column has already contradicted. When it reports one solution, it has finished the walk — uniqueness is a property of the completed search, not of the solver's confidence. The node count it prints is the size of that walk.

Can a letter be zero?

Yes — any letter except the first letter of a multi-letter word. In SEND + MORE = MONEY the unique solution has O = 0, which is legal because O never leads a word. M and S, which do lead, cannot be zero, and the search enforces it.

Does it handle subtraction or more than two addends?

Both. Terms on the left may be joined by + or − (MONEY − MORE = SEND returns the classic assignment read backwards), and FORTY + TEN + TEN = SIXTY shows three addends. The right-hand side must be a single word.

Why does it stop at 1,000 solutions?

Loose puzzles can have enormous solution sets, and listing them all helps nobody. The cap is stated on the results whenever it is reached; for the tight, well-set puzzles the genre prizes, the count is one.

What makes one cryptarithm harder than another?

Constraint, not size. Repeated letters across words tie columns together and prune the search early — ten-letter DONALD + GERALD = ROBERT takes fewer nodes (5,407) than eight-letter SEND + MORE = MONEY (8,650). A puzzle of all-distinct letters with a long result is the genuinely hard shape.

Does my puzzle leave my device?

No. The search runs entirely in your browser; nothing is uploaded or stored.

Next steps