Dots and Boxes · Guide

Dots and Boxes Strategy: Chains, Gifts and the Endgame (2026)

slug: dots-and-boxes-beginner-tips · Last verified 2026-11-08

Try it yourself — play Dots and Boxes now

Free in your browser, no download or sign-up.

Play Dots and Boxes

Last updated: November 2026 · Tested on Playnesta's Dots and Boxes (Playnesta-original MIT; 4×4 / 5×5 / 6×6 boards, easy / medium / hard) · 79-check headless harness · strategy probe replaying 1,200 medium-vs-medium games plus two constructed endgames · the live js/engine.js and js/main.js are byte-identical to the files measured here
Method: every number on this page comes from the shipped build, not from a design note. The rules engine is js/engine.js (Playnesta-original, MIT) and the page shell is js/main.js; the 79-check headless harness passed again in this session, and a separate strategy probe replayed 400 medium-vs-medium games on each board size and built two small endgames to check the gift arithmetic. The two files the live site serves hash to the same bytes as the copies measured here (engine.js 47162313…, main.js a7de46be…). The game page explains the controls and the rules; this page is the strategy layer: which move to choose when every move looks safe, what a three-sided box really costs, and why the endgame is decided before the board looks full. Dots and Boxes is the public-domain pencil-and-paper game published by Édouard Lucas in 1889 as La Pipopipette; the name is a generic description, not a trademark of this site.

1. The board is an edge budget: 40, 60 or 84 moves

Every game on a given board lasts exactly as many moves as the board has edges. A move draws one undrawn edge and nothing else, so the board fills at a fixed rate no matter how either side plays.

Board Boxes Edges Total moves Draw possible?
4×4 16 40 40 Yes — 16 is even
5×5 25 60 60 No — 25 is odd
6×6 36 84 84 Yes — 36 is even

Two rules make those move counts behave differently. Closing the fourth side of a box claims it, and a claim keeps the turn; a move that closes no box passes the turn. A single line can also claim two boxes when two adjacent boxes are both three-sided and share the missing edge. That is the whole game: 40, 60 or 84 one-edge decisions, some of which keep the turn and some of which hand it over.

The default board is 5×5 on medium. The chips change the size and the opponent; the URL can pin them, for example ?size=6&level=hard&seed=7. The board is square, the cells are 100 px apart in a padded square stage, and the page rebuilds the whole SVG when you change size.

2. What a gift really costs: one box, two boxes, or a chain

A box with three sides drawn and no owner is a gift: whoever draws its fourth side claims it and keeps the turn. The important part is not the box; it is the extra turn. If that turn also closes the next box, the gift does not stop at one.

Two adjacent three-sided boxes can share their missing edge. In that position one line claims both at once. The probe builds exactly that shape on a 4×4 board: free boxes 0 and 1, each with three sides, sharing the missing vertical edge. Drawing that one edge returns boxes: [0, 1], extra: true, and the score jumps from 0–0 to 2–0 in a single move.

In ordinary medium-vs-medium play this is not a rare curiosity. The probe counted every line that claimed two boxes at once:

Board Two-box lines per game (400 games) Total
4×4 0.32 129
5×5 0.51 202
6×6 0.80 320

So the first rule of the strategy layer is simple: do not create a three-sided box unless every legal move does. A three-sided box is not a neutral edge; it is a signed cheque. Two three-sided boxes sharing an edge are a cheque for two boxes with the same signature.

3. Chains: open the shortest one, not the nearest one

A chain is a group of boxes that can be taken in one turn once it is opened. Claiming keeps the turn, so an open chain of length L is L boxes for the player who starts taking it. The probe checks the arithmetic on a constructed 4×4 row: a three-box chain goes down in three captures, a lone three-sided box in one. The difference between opening a chain of 3 and opening a chain of 1 is 2 boxes, not one.

That is why "open the nearest chain" is the wrong instinct. When no free box is left, you are forced to make a quiet move that creates a three-sided box; the only choice is which one. Open the chain that gives away the fewest boxes, even if it is on the far side of the board.

The measured cost of opening is larger than most players expect. The probe records an opening as a non-capturing move made when no free box existed, which then creates at least one free box; it counts every box the opponent takes before they have to open the next chain.

Board Openings per game Boxes conceded per opening
4×4 3.9 4.1
5×5 5.2 4.8
6×6 6.8 5.3

Those averages come from medium-vs-medium games, so they describe this build's opponent rather than perfect play. They still make the point: a "one-box gift" is usually the start of a run worth four or five boxes. The player who opens the first chain often loses the game on that one decision.

The shipped opponent only partly sees this. Medium scores each quiet move with a one-ply giftCost: it counts the boxes it would make three-sided, plus one extra for each such box that already touches another free box. It does not see a corridor of two-sided boxes that would become a chain after the first capture. Hard plays the rest of the board out for each candidate and therefore values longer chains more accurately. Neither level plays the double-cross (deliberately leaving two boxes so the opponent has to open the next chain), so a chain you open is normally taken to the end.

4. Why "fill the edges first" is an illusion

A common beginner plan is to draw the outer edges and corners first, "save" the middle, and only then start closing boxes. The board does not cooperate. Every move adds exactly one edge, and the game ends only when every edge is drawn. There are 40, 60 or 84 moves in total; you cannot save an edge for later, and you cannot change the total by choosing a corner.

What actually varies is the split between capturing moves and non-capturing moves. A capturing move keeps the turn, so a run of captures can remove several boxes before the turn changes. The probe measured the non-capturing share in 400 medium-vs-medium games:

Board Average non-capturing moves Share of all moves
4×4 24.32 of 40 60.8%
5×5 35.51 of 60 59.2%
6×6 48.80 of 84 58.1%

Roughly three moves in five pass the turn. The game is therefore a tempo problem: who is forced to make the first quiet move that creates a free box, and how many boxes that opening hands over. Corners and outer edges are not a resource; the move order is.

5. Draws, parity and the last box: what 16, 25 and 36 decide

The box count decides whether a draw is possible. A draw needs both players to finish level, so the total must be even. The 4×4 board has 16 boxes and the 6×6 board has 36; both can end level. The 5×5 board has 25 boxes, so somebody must win.

The probe's 400 medium-vs-medium games per size show that draws are not theoretical:

Board Starter wins Computer wins Draws
4×4 193 (48.3%) 137 (34.3%) 70 (17.5%)
5×5 164 (41.0%) 236 (59.0%) 0
6×6 201 (50.3%) 179 (44.8%) 20 (5.0%)

The last box is not fixed to the starter. In the same 400-game samples, the starter claimed the last box 301 times on 4×4, 136 times on 5×5 and 242 times on 6×6. The 5×5 result is the useful correction: the board cannot draw, but the last box can belong to either player. Do not plan around a "last box always belongs to the first player" rule; it is not in the engine and it is not in the measurements.

Parity does decide one thing: on 5×5, a level final score is impossible. With one box left, the score before the last claim is either level (12–12) or separated by an even number; after the last claim the final score is still unequal. No sequence of legal play can turn 25 boxes into two equal totals.

6. The three computer levels, read from the shipped code

The three levels are not three different rule sets. They are three different search budgets on the same legal moves.

Level What it does on a turn Known limit
Easy If a capture exists, takes one 75% of the time; otherwise picks a random quiet move 60% of the time; otherwise any legal move. It can decline a free box.
Medium Takes every free box. With no capture, picks the move with the smallest one-ply giftCost; random among ties. It sees only the boxes a move makes three-sided, plus immediate free neighbours.
Hard Samples up to 26 legal candidates, plays the rest of the board out with the medium policy on both sides, and keeps the candidate with the best final margin. It is still a one-ply sample-and-rollout, not a solved table, and it never plays the double-cross.

Two details matter in practice. First, medium always takes a free box. If you leave a three-sided box, it will claim it, and because a claim keeps the turn it will keep claiming until no free box remains. Second, hard's sample is capped at 26 candidates. On a full 6×6 board there are 84 legal edges, so the first move of the game is chosen from a sample, not from all 84. The seed pins the sample and the tie-breaks; it does not make the search exhaustive. That cap has a measurable consequence: when a free box exists but the board is wide, the sample can miss the capture. In 40 constructed midgame positions per board with at least one free box, hard declined a capture 14 times on 4×4, 26 on 5×5 and 32 on 6×6. Taking a free box dominates declining it — you score and keep the turn — so this is a sampled-rollout error, not a strategy to copy.

The Hint button uses the hard policy with Math.random, not the seeded random generator. A pinned game therefore has a reproducible computer reply but not a reproducible hint. The hint marks one line, counts itself for the current game, and never draws the line or changes the score.

7. A turn checklist for dots and boxes

You do not need a clock or a solver to play this build well. Run the same six checks on every turn:

  1. Take every free box. The score is boxes, not style. If a box has three sides, close it and keep the turn.
  2. Count what is left. After the run of captures, count the remaining boxes and the chains they form. The board is small enough to count; 16, 25 and 36 are not large numbers.
  3. If there is no free box, open the shortest chain. Not the nearest, not the one that "looks safe". Count the boxes it would give away.
  4. Avoid creating a three-sided box, especially a shared-edge pair. A single three-sided box is a gift; two adjacent ones sharing the missing edge are a two-box gift in one line.
  5. Watch the score, not the shape. A pretty board with fewer boxes is a loss. The only number that matters is the difference.
  6. Use Hint only at the chain-choice moment. It is most useful when the board is quiet and you are deciding which chain to open; using it earlier spends the same hint on a move you could already see.

A worked endgame makes the arithmetic concrete. Suppose the score is 6–6 on a 4×4 board and four boxes remain, split into a chain of 1 and a chain of 3. If you open the 1, the computer takes 1 (6–7), then must open the 3; you take all 3 and win 9–7. If you open the 3 first, the computer takes 3 (6–9), then opens the 1; you take 1 and lose 7–9. Same four boxes, same board, opposite result — the only difference is which chain you opened first.

8. Hint, restart and the local record

The page's controls are deliberately small. Hint marks one line from the hard policy and increments the hint counter; it does not draw the line, does not change the score, and cannot be used while the computer is thinking or after the game is over. Restart starts the same board size and level again; there is no undo, so a mis-click is a real move. The rules sheet opens from the Rules button, and Sound toggles the synthesised blips.

Your record is local. Wins, losses and draws are kept separately for each board size and level in this browser, under pn.dotsAndBoxes.v1, together with the sound setting. Nothing is uploaded and there is no account. A different browser, a private window or cleared site data starts from zero. The URL parameters size, level and seed pin the board, the opponent and the computer's tie-breaks; seed does not pin the Hint.

On a phone the page fits a 348×261 stage without scrolling: every control is at least 22 px tall and the board stays square. On the 894×670 desktop stage the board is at least 560 px square. Press and drag previews the line under your finger; the line you release on is the one drawn.

9. What this guide does not claim

This is a strategy guide for one shipped build, not a proof. It does not publish a winning strategy for 6×6, a solved table, or a claim that hard is perfect. The hard opponent is a 26-candidate rollout against the medium policy; it can be beaten, and it does not use the double-cross. The medium opponent is greedy by design and will take every free box you leave. The numbers above describe those policies, not an optimal player.

It also makes no population claim. There is no "average player" percentile here, because the page has measured no players. The only comparison the page can honestly make is your own record on the same board size and level.

FAQ

What is the best strategy for dots and boxes?

Take every free box, then count the remaining chains and open the shortest one. The two habits that lose most games are leaving a three-sided box and opening a long chain when a short one is available. On this build, the hard opponent will punish both; the medium opponent will take every free box but only sees one move ahead when it has to give one away.

How do you win at dots and boxes?

Win by owning more boxes when the board is full. The endgame is decided by who is forced to open the first chain and how many boxes that chain gives away. In the probe's medium-vs-medium games, an opening conceded 4.1 boxes on 4×4, 4.8 on 5×5 and 5.3 on 6×6 on average, so the first forced gift is usually the decisive one. On 5×5 somebody must win; on 4×4 and 6×6 a draw is possible.

What is a chain in dots and boxes?

A chain is a group of boxes that can be taken in one turn once it is opened. Claiming a box keeps the turn, so a chain of length L is worth L boxes to the player who starts taking it. A chain of 3 therefore costs two more boxes than a chain of 1. The build's medium opponent sees the first move of a chain, while hard plays the rest of the board out before choosing.

Can dots and boxes end in a draw?

Yes on 4×4 and 6×6, because 16 and 36 are even. No on 5×5, because 25 is odd. In 400 medium-vs-medium games the draw rates were 17.5% on 4×4, 0% on 5×5 and 5.0% on 6×6. A draw is a real result, not a bug; the result card shows it and the local record counts it separately.

Does the computer cheat in Dots and Boxes?

No. The computer sees the same board you see and chooses from the same legal moves. Easy is random with a bias toward captures, medium is greedy with a one-ply gift cost, and hard samples up to 26 candidates and plays out the rest with the medium policy. Hard is stronger, but it is not omniscient: it does not play the double-cross, and its sample is capped.

What does the Hint button do?

Hint asks the hard policy for one move and marks that line. It counts how many hints this game used, but it does not draw the line, change the score or end your turn. It only works on your turn, when the computer is not thinking and the game is not over. Because it uses Math.random, a ?seed= URL pins the computer's replies but not the hint.

Is there a winning strategy for 6×6 dots and boxes?

This page does not publish one, and it does not rely on a solved table. The advice here is a measured heuristic: count the chains, open the shortest, avoid creating three-sided boxes and shared-edge pairs. The hard opponent is a 26-candidate rollout, not a proof of optimal play, so a human who counts the endgame can still beat it.

Why does the computer take the whole chain?

Because claiming a box keeps the turn. Once a chain is open, every capture leaves the same player to move, so medium keeps taking free boxes until none remain. Hard usually does the same, but its 26-candidate sample can miss a capture on a wide board; that is a policy error, not a rule. A human who wants to stop a run would use the double-cross, and none of the three levels plays it.

Why does the page say 5×5 cannot draw?

Because the board has 25 boxes and every box belongs to exactly one player at the end. An odd total cannot be split into two equal whole numbers. The last box can still go to either player; the no-draw rule is about the total, not about who moves first.

More games to play

More free browser games on Playnesta — pick your next round.