Calcudoku solver

Draw the cages of your calcudoku, enter each target and operation, and get the solution or one explained step at a time. For math cage puzzles from 3 by 3 to 9 by 9, including ones that hide the operation.

Tap cells to select a cage

Operation

Tap the cells of one cage (they turn purple), type its target, pick the operation and press Make cage. A one-cell cage is just its number. Tap a finished cage to select it again and change it. Keyboard: arrows move, Space selects, digits type the target, + - * / pick the operation, Enter makes the cage, Esc clears the selection.

Solver

Paste or copy the puzzle as text

This calcudoku solver handles the math cage puzzle you are working on: you draw its cages, type each target and pick its operation, and the solver fills the grid. Press Next step for one number at a time with the reason, or Solve for the whole answer. It also checks that your puzzle has exactly one solution.

The rules

In a puzzle of size n, every row and column holds the numbers 1 to n once each. The grid is divided into cages, outlined in bold. Each cage shows a target and an operation: the numbers in an addition cage add up to the target, a multiplication cage multiplies to it, a subtraction cage of two cells has the target as the difference, and a division cage of two cells has it as the quotient (bigger divided by smaller). A one-cell cage simply gives its number. Numbers may repeat inside a cage as long as they are not in the same row or column.

How to enter a puzzle

  1. Pick the size.
  2. Tap each cell of one cage; the selected cells turn purple.
  3. Type the target, choose the operation and press Make cage. The next empty cell is selected for you. Cells not yet in a cage are shown hatched.
  4. To change a cage, tap it (with nothing selected), edit the target or operation, and press Make cage again.

Some puzzles hide the operation and show only the target. Choose ? for those cages: the solver then accepts any operation that reaches the target. You can also paste a puzzle as text, one cage per line, such as 12 x A1 A2 B1.

How the solver works

For every cage, the solver lists the ways its cells can reach the target with the numbers still possible in each cell, skipping any way that repeats a number in a row or column. A number that no valid way uses is crossed out of that cell. Together with the row and column rule (a number already placed cannot appear again; a number with only one possible cell in a row goes there) this repeats until nothing changes. If cells are still open, the solver tries the options of the most constrained cell and keeps going, and it checks for a second answer before calling a puzzle unique. A target that no numbers can reach, such as a product of 5 in a 3 by 3 grid, is reported by name.

Worked example

In a 4 by 4 grid, a two-cell cage marked 4÷ can only hold 1 and 4, because 4 divided by 1 is the only quotient of 4 using numbers up to 4. A three-cell cage marked 24× can only be 2 × 3 × 4: a set with a 1 would need two numbers that multiply to 24, and two numbers up to 4 make at most 16; trying 2, 3 and 4 with repeats shows only one of each works. So if that cage shares a row with the 4÷ cage, the row can hold only one 4, so it goes in one cage and the other cage must use its other numbers there. Every hint on this page names the cage it uses and the options that cage still has.

Solving tips

  • Start with one-cell cages and with division and subtraction cages that have only one pair, such as 3− in a 4 by 4 grid.
  • For large multiplication targets, factor the number: 60× in three cells of a 6 by 6 grid is {2, 5, 6} or {3, 4, 5}.
  • Add a full row: it always sums to n(n + 1)/2, so if all but one cage of a row are known, the last cell follows.

Calcudoku is a generic name for this puzzle; it is also sold under brand names, and this solver works for any puzzle with these rules.

Like futoshiki and the skyscraper puzzle, calcudoku is a Latin square: each number once in every row and column, so the same counting tricks carry over.

To play instead, open calcudoku online: fresh grids at three levels with hints from this solver.

Solver tested . Found a problem? Tell us.

Questions

Is calcudoku the same as mathdoku?

Yes. Calcudoku, mathdoku and math cage puzzle are names for the same rules: a Latin square split into cages with a target and an operation. This solver works for all of them.

Can numbers repeat inside a cage?

Yes, as long as the two equal numbers are not in the same row or column. In an L-shaped cage, for example, the two ends can hold the same number. The solver allows exactly that.

What if my puzzle does not show the operations?

Choose ? as the operation for each cage. The solver then accepts any of addition, subtraction, multiplication or division that reaches the target, with subtraction and division only for two-cell cages.

Why does the solver say a cell is not in any cage?

Every cell must belong to exactly one cage. Hatched cells are not in a cage yet; select them and make a cage, even if it is a one-cell cage that just gives a number.

Can it solve 9 by 9 puzzles?

Yes. Sizes 3 by 3 to 9 by 9 are supported, and generated 9 by 9 test puzzles solve in a few milliseconds. The search runs in the background, so the page never freezes.