How to play
Dots and Boxes is a pencil-and-paper game for two players on a square grid of dots. Players take turns drawing one horizontal or vertical line between two neighbouring dots. Whoever draws the fourth side of a box claims it: the box fills with that player’s colour, pattern and initial (stripes for you or Player 1, dots for the computer or Player 2), and that player must draw another line straight away. A single line can close two boxes at once. When every line is drawn, the player with more boxes wins.
Boards run from 3×3 to 7×7 boxes. A board of n×n boxes has (n+1)² dots and 2n(n+1) lines, so 5×5 has 36 dots and 60 lines. Play the computer on three levels or a friend on the same device, and choose who moves first or let it alternate. Boards with an even number of boxes (4×4, 6×6) can end in a draw.
Controls
- Mouse: point at the gap between two dots and the line appears faintly in your colour; click to draw it.
- Touch: tap the gap between two dots. The line is drawn when you lift your finger, so you can still slide to another gap. The page does not scroll while your finger is on the board.
- Keyboard: focus the board and press an arrow key to show the cursor. Each arrow then walks the cursor from one dot to the next and frames the line it just passed; Space or Enter draws that line. U or Ctrl+Z undoes, N opens the new-game screen and F switches full screen.
- Undo: against a friend it takes back the last line; against the computer, your last line and every computer move after it.
The last line played glows amber.
How it works
Good play is about chains: rows of boxes that already have two sides each. The first line drawn into a chain lets the opponent take every box in it. Early on both players draw safe lines that give nothing away; sooner or later none is left and someone has to open a chain.
Whoever is handed a long chain (three or more boxes) need not take all of it: they can take all but two boxes and draw the line at the far end, leaving a two-box domino that the other player closes with one line. This trick, double-dealing, costs two boxes, but the other player must then open the next chain. A loop is declined by leaving four boxes. Keeping control like this usually wins the endgame.
Every turn ends with a line that closes no box, except the last turn of the game, and a line that closes two boxes at once is called a double-cross. A board of m×n boxes has 2mn + m + n lines, of which (boxes − double-crosses) close a box, so:
If the player in control declines every long chain except the last, there is one double-cross fewer than there are long chains, and that player also plays the last turn. The first player plays the odd-numbered turns, which gives the long chain rule: the first player wants the number of dots plus the number of long chains to be even, the second player wants it odd. Loops do not change the count, because declining a loop produces two double-crosses.
Easy draws random lines that give nothing away and takes a box you offer only about three times in five. Medium takes every box it can and avoids drawing a third side; when it must give something away it gives the fewest boxes, but it never double-deals. Hard double-deals when keeping control pays. When only a few safe lines are left, it searches the orders in which they can be played and values each endgame with the chain-and-loop analysis, so that you have to open the first chain, and it may give away a box or two to win back control. In 1,200 test games against Medium, 240 on each board size, run on 22 October 2026, Hard won 1,194, drew 2 and lost 4.
Tips and strategy
- Avoid drawing the third side of a box: your opponent takes it and moves again.
- When only a few safe lines remain, work out who will be forced to open the first chain.
- When you have to give something away, give the shortest chain first, and offer a two-box chain by drawing its middle line so that it cannot be declined.
- When you are handed a long chain and more chains are still to come, take all but two boxes and leave the domino.
- On the very last chain, never double-deal: take everything.
Frequently asked questions
Who invented Dots and Boxes?
The French mathematician Édouard Lucas described it in 1889 under the name la pipopipette. The American mathematician Elwyn Berlekamp later wrote a whole book about its strategy.
Why did the computer leave me two boxes?
That was double-dealing: you get two boxes but must then draw another line, which opens the next chain for the computer.
Can I beat Hard?
Yes. Hard plays random safe lines until only a few are left, and on big boards its search has a size limit, so a player who counts chains early can steer the game.
Sources
- Berlekamp ER (2000). The Dots and Boxes Game: Sophisticated Child's Play. A K Peters. The book on chain counting and control mentioned above.
- Peterson I (2003). Dots and Boxes. Science News. States the long chain rule and that there is one double-cross fewer than long chains when the player in control declines every chain but the last.