The 24 game solver takes four whole numbers from 1 through 99 and searches every legal grouping of the four basic operations plus parentheses, returning up to 50 distinct expressions that evaluate to exactly 24. The search uses reduced fractions rather than binary floating-point comparisons, so an expression that requires a fractional intermediate is matched exactly and a value merely close to 24 is never reported as a solution. The contract follows the classic rules documented by the University of California, Santa Cruz mathematics program: use each of the four supplied numbers exactly once, combine them only with addition, subtraction, multiplication, and division, and rely on parentheses to set the order of operations. Concatenation, exponentiation, factorials, roots, decimal insertion, and reuse of a number are deliberately outside the solver's scope. If a hand cannot reach 24 under those rules, the page returns a no-solution verdict, which means the exhaustive search found no construction rather than a failure of the tool itself.

24 game solver
24 game solver

What Counts as a Valid 24 Game Hand

A valid 24 game hand is a set of exactly four positive whole numbers that you must combine into a single arithmetic expression equal to 24. The combination rules are tighter than they first appear. Every number must appear exactly once in the final expression, so a hand like 1, 2, 3, 4 cannot be solved as 2 × 3 × 4 = 24 even though that product happens to be 24, because the input number 1 has been dropped. Only the four basic operations are permitted: addition, subtraction, multiplication, and division. Parentheses are permitted because they encode the order in which the operations are evaluated, and they are what distinguish a valid 24 game construction from a flat left-to-right calculation that misses the target.

The boundary deliberately excludes several shortcuts that show up in puzzle variants and rule extensions. The solver does not concatenate digits, so the numbers 1, 2, 3, 4 cannot be merged into 12, 34, or 123. Exponentiation, factorials, square roots, and decimal-point insertion are all turned off, because each of those operations would let many otherwise-impossible hands reach 24 and would also generate solutions that the basic-rules community does not accept. Unary negation as an extra operation is also excluded; a leading minus sign is treated only as part of subtraction between two terms. The University of California, Santa Cruz mathematics program documents this rule set in its 24 Game description, and an independent fraction-based checker at 4nums cross-checks solvability against the same basic operations.

Commercial card editions sometimes restrict the input range further, but the 24 Game Solver deliberately accepts any four positive whole numbers from 1 through 99 while keeping the standard operation contract. That wider range lets the same tool cover classroom practice, app-based puzzles, and the longer numerical hands that a teacher or puzzle designer may construct, all without changing the underlying rules.

How to Use the 24 Game Solver

  1. Enter exactly four whole numbers from 1 through 99, one number in each of the four input fields.
  2. Select Solve to exhaustively search the allowed arithmetic operations with exact fractions.
  3. Read any returned expression from inside the parentheses outward, treating each grouping as a single term until only the result 24 remains.
  4. If the page reports no solution, treat that as the verdict for the basic rules; verify that the source puzzle is using the same rules before concluding the hand is unsolvable.

All processing happens in the browser, so the four numbers and the generated expressions are not uploaded, stored, or attached to an account. There is no login requirement and no usage limit, which makes the tool suitable for repeated classroom practice, repeated testing of curated hands, or quick checks of a single puzzle.

How Fraction Math Keeps Results Exact

The hardest part of a 24 game search is not the listing of operations; it is the safe handling of division. Several famous hands, including 3, 3, 8, 8 and 1, 5, 5, 5, only reach 24 through a fractional intermediate result. If the solver worked in binary floating-point arithmetic, those hands would either round to a value that does not equal 24 or miss the equality check entirely because of accumulated rounding noise. The solver avoids that failure mode by storing every intermediate value as a reduced fraction: an integer numerator and a positive integer denominator, both reduced by their greatest common divisor at each step. The equality test is then a single integer comparison: numerator must equal 24 multiplied by denominator. A value merely close to 24 never matches, and a valid path through a repeating decimal is preserved.

Consider the hand 3, 3, 8, 8. One valid construction is 8 ÷ (3 − 8 ÷ 3) = 24. Step by step: 8 ÷ 3 = 8/3, then 3 − 8/3 = 1/3, then 8 ÷ (1/3) = 8 × 3/1 = 24/1, which satisfies numerator equals 24 times denominator. The exhaustive search picks up both subtraction orders and both division orders at each step, so the negative denominator case never contaminates the result, and the recursive selection of unordered pairs explores every parenthesis structure until only one term remains.

Reading Returned Expressions From the Inside Out

The solver returns each expression in full, followed by = 24, so a proposed answer can be checked directly instead of accepted as an unexplained success. The order of evaluation follows the parentheses: every pair of matched parentheses is a single subexpression that should be computed first, then handed back to the surrounding term, and so on until the outer operation collapses to 24. With three pairs of parentheses typical of a four-number hand, the natural habit is to start at the innermost grouping, replace it with its numeric value, and read the simplified outer expression until the final number remains.

Parentheses are significant and should not be removed casually. The expression (1 + 3) × (2 + 4) reads as 4 × 6, which equals 24. The same numbers without parentheses, 1 + 3 × 2 + 4, reads as 1 + 6 + 4, which equals 11. Two strings of symbols can therefore represent the same digits with very different arithmetic intent, and the difference is entirely carried by the parentheses. When you verify a returned expression by hand, treat the parentheses as the source of truth for the order of operations, even if the visible result looks obvious once simplified.

When No Solution Is the Verdict

If the page reports no solution, it means the exhaustive search explored every unordered pair selection, every pairing of operations across both subtraction orders and both nonzero division orders, and every parenthesis structure reachable under the disclosed operation set, and found no construction that reduces to exactly 24. That verdict is not a failure of the tool; it is a conclusion about the hand under the stated rules. A hand that the solver marks as unsolved remains a perfectly valid mathematical object, but no expression built only from +, −, ×, ÷, and parentheses can produce 24 from it.

A well-known example is 1, 5, 11, 13. Under the basic rules this hand is unsolvable, and any solver that claims otherwise is either allowing a forbidden operation or rounding an inexact intermediate. Before accepting a no-solution result, the only checks worth running are: that the four numbers were copied correctly into the fields, and that the source puzzle is using the same operation rules as this solver. A puzzle that allows powers, factorials, concatenation, or repeated use of a number is a different problem and may have answers that this deliberately constrained solver will not show.

Test Hands the Solver Verifies

A small set of well-known hands covers most of the behaviors the solver has to handle. Solvable hands with integer-only paths confirm that the simplest route still works. Solvable hands that require fractional intermediates confirm that the reduced-fraction arithmetic actually pays off. Unsolvable hands under the basic rules confirm that the no-solution verdict is not overclaimed.

HandClassification under basic rulesWhy it matters
1, 2, 3, 4SolvableSimple integer path that any working solver must catch.
3, 3, 8, 8SolvableNeeds the fractional intermediate 8/3; integer-only searches miss it.
1, 5, 5, 5SolvableNeeds the fractional intermediate 1/5; reduces to 24 via the basic operations.
1, 5, 11, 13UnsolvableConfirms that the no-solution verdict is honest, not a missed match.

Two of those hands also double as practice material: try 3, 3, 8, 8 on paper before opening the solver, then compare your construction with the list of returned expressions to see whether you found a form the solver did not list, or simply a reorder of the same arithmetic idea. Up to 50 distinct constructions are shown per run; that bound keeps the result list readable and prevents a hand with many equivalent rearrangements from filling the page. Because the result list deduplicates by expression string, reordered constructions can still appear as separate entries only when their symbolic form differs, not when they are the same arithmetic idea written in a different order.

For classroom or puzzle practice, the natural workflow is to attempt a hand first, then verify your construction against the returned list. If your construction does not appear, look at the parentheses; a missing or misplaced bracket is the most common reason a hand-calculated expression disagrees with the solver output. If your construction does appear, the match is direct evidence that the hand reduces to 24 under the rules the solver is enforcing.