Play Dots and Boxes Online
Take turns drawing lines between dots. Complete a box to score a point and earn a bonus turn. The player with the most boxes wins!
Created by Brian Hamilton
Player Setup
Player 1’s turn
How to play Dots and Boxes
Take turns drawing one line between two neighbouring dots. Complete a box to claim it.
- Complete the fourth side of a box and you claim it and move again.
- One line can complete two boxes at once — both are yours, and you still move again.
- Because of the extra turn, a chain of boxes falls in a single turn: opening one hands over all of it.
- So the middlegame is a race to leave your opponent with no safe move — one that puts no box onto three sides.
- The game ends when every line is drawn. Most boxes wins.
Controls: tap the gap between two dots to draw a line. Set the board size, the number of players, and whether each is human or AI, above the board.
Almost every box is won in a handful of turns
Dots and Boxes looks like a game of steady accumulation, one square at a time. It is nothing of the sort. Playing out 300 games and recording every scoring turn: 86% of all boxes were captured in turns that took three or more at once, and the largest single turn took nineteen.
That is the whole game in one number. The long middle section, where both players carefully avoid giving anything away, decides nothing directly — it decides who is forced to hand over the first big run. Everything before that is positioning for a moment that arrives all at once.
Why chains fall all at once
Completing a box earns you another turn. That single rule is what turns a line of boxes into an avalanche: take the first, move again, take the second, move again, and so on to the end of the run.
So a chain of five boxes is not five separate opportunities. It is one indivisible prize, and it belongs to whoever does not have to open it. Drawing the first line into a chain is not a small concession — it is handing over the entire thing.
The middlegame is a game of who runs out of safe moves
Once you understand that, the earlier part of the game changes character. Every move you make is either safe — it leaves no box on three sides — or it is a gift. The whole middlegame is a race to make the other player run out of safe moves first.
Which means counting, not intuition. Before each move, look for lines that touch no box already on two sides. When those run out, someone has to open a chain, and it should not be you.
The habit worth building: never draw the third side of a box unless you have counted what happens next. Most losses are not clever traps — they are a safe-looking move that turned out to be the last safe move available.
Give two boxes back to keep control
Here is the move that separates people who have thought about this game from people who have not. When your opponent finally opens a chain, the obvious reply is to take all of it. That is usually a mistake, because taking the last box forces you to move again — and with no safe moves left, you must open the next chain yourself.
Instead, take all but the last two, then draw a line straight through the middle of those two, giving them away in a single move. Your opponent gets two boxes. You keep the turn, and now they must open the next chain.
This is the double-cross, and it is why the number of long chains matters so much: each one you decline costs you two boxes but wins you the one after it. With several long chains on the board, that trade is overwhelmingly worth it.
Where players go wrong
Taking everything on offer. Greed loses control, and control is worth more than two boxes whenever a longer chain remains.
Treating the opening as unimportant. The moves that look arbitrary are deciding how many long chains the endgame will contain. That count is the game.
Drawing the third side without looking. A box on two sides is safe; on three it is a present. That is the only distinction that matters when choosing a quiet move.
Playing to the edges early. Edge boxes need fewer lines and so become dangerous sooner.
What was verified on this page
The rule everything depends on was checked hardest. Placing a line and claiming the right boxes was compared against an independently written implementation across 30,647 line placements on four board sizes — including the 553 occasions where a single line completed two boxes at once, which is the case a naive implementation gets wrong.
The extra turn was checked by playing 180 complete games under the rule and testing the invariant that must always hold: the boxes on the board equal the two scores added together, every box is claimed by the end, and each one is credited to the player who actually closed it. All three hold in every game.
| What was checked | Cases | Wrong |
|---|---|---|
| Placing a line and claiming boxes | 30,647 | 0 |
| …of which completed two boxes at once | 553 | 0 |
| Complete games under the extra-turn rule | 180 | 0 |
| Move helpers the AI relies on | 16,799 | 0 |
| Free boxes offered to the AI | 289 | 0 |
The three helpers the AI depends on — would this move complete a box, would it hand one over, and how many — were checked against an independent reference on 16,799 candidate moves. And both the Medium and Hard settings took the free box in all 289 positions that offered one, which is the single move in this game that is always right: it scores and it grants another turn, so it can never cost you anything.
One thing is worth being straight about. The famous long chain rule — that whoever is forced to open the first long chain generally loses — is not demonstrated here. Measured across these games it came out at roughly a coin flip, because the rule describes deliberate sacrifice play and the AI on this page does not play that way. The rule is real; this page's engines simply do not exercise it, and reporting the number as if it confirmed the theory would be misleading.
A game with real mathematics behind it
Dots and Boxes is the subject of a genuine mathematical literature, most of it due to Elwyn Berlekamp, who wrote a book on it. The chain-counting arguments turn into a theory of “loony” endgames and connect to the same combinatorial game theory that solves Nim.
The practical upshot is unusual: a game that looks like idle doodling has an endgame you can genuinely calculate, and a beginner who learns one idea — give two back to keep control — will beat a beginner who has not, essentially every time.
More games like this
If you like games where giving something up is the strongest move, try these: