Strategy game
Dots and Boxes: Draw Lines, Claim Squares
Play Dots and Boxes free in your browser. Draw lines, close squares and move again, against the computer or a friend, on 3×3, 4×4 or 5×5 boards.
Dots and Boxes
Draw a line, close a square, then move again.
How it plays
Dots and Boxes is a pencil-and-paper game for two players. You start with a grid of dots. Players take turns drawing a line between two neighbouring dots, and whoever draws the fourth side of a square claims it and must draw again. When every line has been drawn, the player with more squares wins. There are no dice and no hidden cards: everything that matters is on the board.
This version plays in your browser, against the computer or with a friend on the same screen. There is nothing to download and no account to create, and you can choose a small, medium or large board.
How to play Dots and Boxes here
Pick a board size from the menu: 3 × 3, 4 × 4 or 5 × 5 squares. The 4 × 4 board is selected when the page opens. Then choose Play the computer or Two players. Red always draws first; against the computer, you are red and the computer is yellow.
To draw a line, click or tap the pale segment between two dots. Lines you draw turn red, the other player's turn yellow, and the most recent line has a dark outline so you can see what just happened. When you complete a square it fills with your colour and your letter, R or Y, and it is your turn again.
- The score above the board counts each player's squares, and the line under it says whose turn it is.
- Undo takes back your last line, including any squares it claimed. Against the computer it also removes every line the computer drew after yours, so it is your turn again.
- New game clears the board. Changing the board size or the mode starts a new game too.
- On a keyboard, Tab moves from line to line and Enter or Space draws the selected line.
The game ends when the last line is drawn, and the result appears under the board.
Dots and Boxes rules
- Red draws first, then the players alternate, except that a player who claims a square draws again.
- A line joins two dots next to each other, horizontally or vertically. Diagonal lines are not allowed, and a line can only be drawn once.
- The player who draws the fourth side of a square claims it. It does not matter who drew the other three sides.
- If one line completes two squares, the player who drew it claims both and still draws once more.
- When every line has been drawn, the player with more squares wins.
The three boards here have 24, 40 and 60 lines. On the 3 × 3 and 5 × 5 boards the number of squares is odd, so there is always a winner. On the 4 × 4 board a game can finish 8 to 8, which is a draw.
Playing against the computer
The computer is yellow and draws after a short pause. Its choices follow a simple order:
- If a square has three sides, it takes it, and keeps taking squares for as long as it can.
- Otherwise it draws a line that does not give you a square, picking at random among the safe lines.
- When no safe line is left, it works out how many squares each possible line would hand you and draws the one that gives away the fewest.
That makes it careful in the opening and greedy at the end. What it does not do is count chains ahead of time or sacrifice squares on purpose, and that is where it can be beaten.
Strategy: safe lines, chains and the double-cross
Do not draw the third side. A square with three sides is a gift: the next player draws the fourth side, claims it and moves again. Early in the game there are plenty of lines that do not create a three-sided square, so use them.
Take what is offered, but look first. Claiming a square always gives you another line to draw. Before you take a square, check what you will have to do afterwards, because after the last square you take you still have to draw one more line, and that line may open something for your opponent.
Think in chains. In the middle of the game the board turns into chains, rows of squares where taking one opens the next. When the safe lines run out, someone has to open a chain, and the other player usually takes the whole thing. If you have to open one, open the shortest.
Learn the double-cross. When your opponent opens a long chain, you can take every square except the last two, then draw the line at the far end of those two instead of taking them. Your opponent gets two squares, but then has to open the next chain for you. Giving up two squares to keep control is how strong players win long endgames, and it is the trick the computer on this page never uses.
Count the long chains. In the endgame, whether you want to be in control depends on how many long chains there are and who will be forced to open the first one. Working this out from the number of dots and long chains is the deepest part of the game; the simple version is to notice, as soon as the safe lines are nearly gone, who will have to move first.
Where the game comes from
The game was described in print by the French mathematician Édouard Lucas in 1889. Because the rules are so short and the endgame comes down to counting, its strategy has since been studied in detail by mathematicians. On this page a 3 × 3 game is over in a few minutes, while a 5 × 5 game leaves room for long chains and real endgame planning.
FAQ
How do you play Dots and Boxes?
Players take turns drawing one line between two neighbouring dots, across or down, never diagonally. Whoever draws the fourth side of a square claims it and draws another line. When every line has been drawn, the player with more squares wins.
What happens when you complete a box?
The square is yours: it fills with your colour and your letter, and you must draw another line straight away. One line can complete two squares at once when they share that side, and both count for you.
Can Dots and Boxes end in a draw?
Only on the 4 × 4 board, where 16 squares can split 8 to 8. The 3 × 3 board has 9 squares and the 5 × 5 board has 25, so one player always ends up with more.
How strong is the computer in Dots and Boxes?
It takes every square it can, avoids drawing the third side of a square while it has a choice, and when it has to give squares away it gives away as few as possible. It does not use the endgame trick of turning down the last two squares of a chain, so a player who learns that trick can beat it.
What is a chain in Dots and Boxes?
A chain is a row of squares joined so that taking one square opens the next. Once a chain is opened, the other player can usually take every square in it, one after another, so late in the game the whole contest is about who has to open the chains.
Can I play Dots and Boxes with a friend?
Yes. Choose Two players and pass the screen: red draws first, then yellow, and a player who claims a square moves again. Both players use the same device; there is no online play.
More games
For another game for two, try Connect Four, where discs drop into columns and four in a row wins, or Mancala, where you sow stones around the board and capture across it. You can also see all games.
Players’ notes
Stuck on a board, or found a trick worth sharing? Leave a note. No account needed.








No notes yet. Yours would be the first.