Shikaku Solver
Stuck on a Shikaku? Type in its numbers and the solver cuts the grid into rectangles, one at a time if you like, with the reason each one has to go where it does. It also tells you when a puzzle has two answers or none. Fancy a fresh one instead? Play our free Shikaku game.
Built by Brian Hamilton
Tap a square and type its number, or pick an example, then press Solve.
Paste or copy the puzzle as text
Example row: 6 . 4 . . 5. A one-line ID such as 6x6:3d3b3c6a4b5d6h4a2b works too.
How to use the solver, and the rules it follows
Cut the whole grid into rectangles so that every rectangle holds exactly one number and is made of exactly that many squares. No gaps, no overlaps. A square counts as a rectangle.
- Set the size with Columns and Rows, from 2 to 30 each way. The grid does not have to be square.
- Tap a square, then type its number on your keyboard or the number pad. For 12, type 1 then 2. Empty square, Backspace or 0 clears it. The arrow keys move between squares.
- The line under the grid adds the numbers up as you go. They must come to the number of squares in the grid.
- Solve says whether the puzzle has one answer, more than one, or none. Show next rectangle then draws one rectangle and gives its reason; Show them all draws the lot.
- Copy link puts the puzzle in a link to share or come back to.
Type the numbers in and watch the total
Set the grid to the size of your puzzle, tap a square and type its number. Most of a Shikaku grid is empty, so there is not much to enter: a 9×9 from our game has about 23 numbers in its 81 squares. If the puzzle is already text, open Paste or copy the puzzle as text instead.
| Format | What to type | Example |
|---|---|---|
| Grid | One row per line, squares separated by spaces or commas; a dot, a dash or 0 for an empty square | 3 . . . . 3 |
| Compact grid | One character per square. Only when every number is a single digit | 3....3 |
| One-line ID | The size, then the squares in reading order: a letter stands for a run of empty squares (a is 1, z is 26) and an underscore separates two numbers that touch | 6x6:3d3b3c6a4b5d6h4a2b |
The line under the grid keeps a running total. The rectangles cover every square exactly once and each number is its rectangle's size, so the numbers must add up to the number of squares: 36 on a 6×6, 100 on a 10×10. Get one number wrong and the total is wrong too, because changing a single number always changes the sum. The Does not add up example is the guide puzzle with its 5 typed as a 6.
A number in the wrong square is harder to catch. The total still comes out right. We took 600 puzzles from our game, moved one number in each to the empty square next door, and asked the solver what it thought. In 285 it found no answer, and in 42 it found more than one. In the other 273, nearly half, the puzzle still had exactly one answer: a different puzzle, and a perfectly good one.
So if the solver's answer looks nothing like the grid you have half finished, check where each number sits, not only what it says.
Three rules do most of the work
The solver does not hunt for the answer blindly and then read it back to you. It works the way you would, with three rules, and Show next rectangle tells you which one it used. All three are about rectangles that fit a number: the right size, on the grid, holding that number and no other, and not overlapping anything already drawn.
- One rectangle fits. Draw it. Each rectangle drawn takes squares away from its neighbours, so this rule keeps firing.
- Only one number can reach a square. That number's rectangle has to cover the square, which often leaves it a single choice.
- A rectangle would cut a square off. If drawing it leaves some square that no number could reach any more, it is wrong. Rule it out.
Here is the 6×6 from our Shikaku strategy guide, numbered in the order the solver drew it. The first two rules were enough.
That mix is typical. Across 1,500 puzzles from our game, 100 at each size and difficulty, the solver drew 43,413 rectangles and recorded the rule behind each one:
| How the rectangle was found | Rectangles | Share |
|---|---|---|
| Rule 1: the only one that fitted from the start | 6,827 | 15.7% |
| Rule 1: the only one that still fitted | 23,119 | 53.3% |
| Rule 2: a square only it could reach | 12,351 | 28.5% |
| Rule 3: the others cut a square off | 774 | 1.8% |
| None of the three: a trial | 342 | 0.8% |
The third rule: do not cut a square off
Rule 3 is the one people miss, because nothing on the board points at it. Load the 7×7, all three rules example and step through. Three rectangles go down easily. Then the 5 in the top row has two rectangles that fit, both strips lying along the top edge, and neither of the first two rules can choose between them.
When you are stuck on a puzzle of your own, this is the check to run by hand: take a number with two or three rectangles left, picture each one drawn, and look for a square left stranded beside it. Corners and edges are where it happens most, because fewer numbers can reach them.
When the rules run out, the solver tries and backs out
Sometimes none of the three rules applies. The solver then takes the number with the fewest rectangles left, tries each in turn, and follows the consequences until all but one break down. It says so plainly when it does this, because there is no neat reason to give you. It is not a blind guess, though: a puzzle with one answer always lets you rule the wrong rectangles out. You just have to look further ahead than one square.
| Grid | Rules 1 and 2 finished it | Needed rule 3 | Needed a trial |
|---|---|---|---|
| 5×5 | 293 | 3 | 4 |
| 7×7 | 263 | 23 | 14 |
| 9×9 | 223 | 46 | 31 |
| 11×11 | 174 | 75 | 51 |
| 14×14 | 117 | 94 | 89 |
Size matters more than the difficulty setting. The first two rules finished 414 of the 500 Easy puzzles, 349 of the Medium and 307 of the Hard. Even so, a puzzle that needs a trial rarely needs many: 342 rectangles out of 43,413, and never more than 7 in one puzzle.
When the grid can be cut two ways, or not at all
The solver does not stop at the first way of cutting the grid up. It keeps looking for a second, and the verdict tells you what it found.
| Verdict | What it means | If you expected one answer |
|---|---|---|
| One answer | No other set of rectangles fits every number. The puzzle is sound. | — |
| More than one answer | At least two sets fit. The shaded squares are where they differ, and you can flip between them. | A number is in the wrong square |
| No answer: does not add up | The numbers do not total the number of squares. | A number is wrong or missing, or the grid is the wrong size |
| No answer: names a number or square | That number has no rectangle that fits, or nothing can reach that square. | Look at the numbers around the place it names |
The Two answers example started as a sound 5×5 from our game. Moving one 2 up a square was enough to break it:
That shape is worth knowing: two 2s at opposite corners of a 2×2 block that they fill between them can always be cut two ways. A puzzle with one answer cannot contain it, so when the solver shades a block like this, one of those numbers belongs somewhere else.
When there is no answer, the solver tries to say where it goes wrong. In the copying test above, 281 of the 285 no-answer verdicts named a number with no rectangle left or a square nothing could reach.
Big grids, oblong grids and IDs from other apps
The grid can be any size from 2×2 to 30×30 and does not have to be square. Size is not a problem for speed: we timed 50 single-answer 30×30 grids with about 150 numbers each, and the solver took under a hundredth of a second on a typical one and under a tenth on the slowest. Everything runs in your browser, and the verdict shows how long your own puzzle took.
The one-line ID in the table above is the same game ID that the Rectangles puzzle in Simon Tatham's Portable Puzzle Collection uses, so an ID copied from that program can be pasted straight in. Copy link uses it too, which keeps links short enough to send.
Shikaku, Rectangles, Divide by Squares
Shikaku was first published by the Japanese puzzle magazine Nikoli. In English the same puzzle appears as Rectangles, Divide by Squares and Divide by Box. The rules are identical under every name, so the solver works for all of them.
A fresh grid to play, and solvers for other puzzles
Our free Shikaku game deals puzzles from 5×5 to 14×14 at three difficulties, and every one is checked by this solver before you see it. That check matters more than you might expect: at 14×14 Easy only about 1 in 190 of the layouts it tries has a single answer, and the rest are thrown away. Building the solver also fixed a fault in the game. It used to give up after 300 layouts, which at 14×14 Easy happened on 12 of 40 requests we measured and left the page stuck on “Generating puzzle”.
For other puzzles, the KenKen solver works from cages and the Sokoban solver finds the fewest pushes. The rest, including best move calculators for Checkers and Gomoku, are on the calculators page. If you like cutting a grid into regions, Galaxies and Nurikabe use the same instinct with different shapes.