Tic-tac-toe is solved: with perfect play on both sides it is always a draw, so nobody can force a win against an opponent who makes no mistakes. You never lose if you win when you can, block when you must, and stop your opponent's forks. You win when the other side slips — and the corner opening gives them the most room to slip: seven of their eight replies lose, and only the centre holds.
There are eight lines on the board: three rows, three columns and two diagonals. A square is worth as much as the number of lines it belongs to. The centre is on four of them, each corner on three, each edge square on just two.
That is the whole reason the centre and the corners are the squares to fight over, and why an edge is the weakest place to start. It is also why the two most important defensive answers below are “take the centre” and “take a corner”.
A threat is two of your marks in a line with the third square empty. One threat wins nothing: the other side simply blocks it. A fork is a move that makes two threats at once. Only one can be blocked, so the second one wins.
Almost every game of tic-tac-toe that is not a draw is decided by a fork, and almost every loss starts one move earlier, with a move that allowed it. So the defence is not “block threats” — anyone sees those — but “do not let a fork appear”.
On every turn, take the first move on this list that is available. It is the order Allen Newell and Herbert Simon used for their tic-tac-toe program in 1972. We ran it against every possible sequence of the opponent's moves: it never loses, whether it moves first or second — with the precise wording of rule 4 below, which is where most retellings go wrong.
The list guarantees a draw, not a win. It also does not always pick the trickiest move — for that, see the openings below.
All nine first moves lead to a draw with perfect play. What differs is how many of the opponent's replies lose on the spot:
| Your first move | Replies that lose | Replies that hold |
|---|---|---|
| A corner | 7 of 8 | only the centre |
| The centre | 4 of 8 | any corner; every edge loses |
| An edge | 4 of 8 | the centre, the two neighbouring corners, the opposite edge |
So the corner is the strongest practical opening: the opponent has exactly one good answer. If they find it, play the opposite corner. That sets the trap below — and against a player who knows the trap, it is still a draw.
If they answer your corner with anything except the centre, a fork is never more than two moves away. A typical line: they reply on an edge next to your corner; you take the centre, which threatens the diagonal; they block in the far corner; you take the remaining corner on your side and have two threats.
Opening in the centre works the same way one step later. If they reply in a corner (the correct answer), take the opposite corner: now every edge loses for them and only a corner holds.
The second player cannot win against correct play, but has only one real job: answer the first move correctly, then avoid the two classic traps.
Trap one: two opposite corners around your centre. They open in a corner, you take the centre, they take the opposite corner. The natural-looking move — another corner — loses: you threaten, they block, and their block is a fork. Take an edge instead: it makes a threat on a square that does them no good.
Trap two: their centre, your corner, their opposite corner. Here it is the other way round: you must take a corner, and an edge loses.
The numbers in this section were computed from the game's own code: every line of play, against every choice the computer can make, including its random ones.
Normal takes a win when it sees one and otherwise plays anywhere. It never blocks. Put two in a line and complete them on your next move. With the best play you win 99.5% of games when you move first and about 92% when it does; the rest is a random move that happens to land on your square, or a line you left open for it.
Hard wins when it can, blocks your threats, and otherwise takes the centre, then a random corner. When you move first, it is a forced win, every time: open in a corner — Hard takes the centre; take the opposite corner — Hard has no threat to block, so it takes one of the two free corners, which makes a threat; block it, and your block is a fork. When Hard moves first it always opens in the centre, and from there no sequence of your moves beats it, not even with luck: take a corner and the game is a draw.
Expert plays perfectly and cannot be beaten; a draw is the best result there is. Among equally good moves it picks the one that leaves you the most losing replies. In practice: moving first, it always opens in a corner, where seven of your eight replies lose — answer in the centre. Its next move is next to its own corner, an edge or a corner, and it makes a threat: block it, then keep following the move order above. When you move first, it answers a corner with the centre, the centre with a corner, and an edge with a corner next to it.
Tic-tac-toe is the smallest game in our list of solved games. How a machine searches it, square by square, is the first step of how machines learned to play; if the game has become too easy, its big sister ultimate tic-tac-toe puts nine boards in one and is nowhere near solved by hand.
Yes. With perfect play on both sides it always ends in a draw. The game is small enough — 255,168 possible games, 765 essentially different positions — for a short program to check every line.
No. Against an opponent who makes no mistakes the best result is a draw. You win only when the other side slips; the corner opening gives them the most chances to, because seven of their eight replies lose.
A corner. Every first move draws with perfect play, but after a corner only one reply — the centre — avoids a loss. After the centre or an edge, four of the eight replies lose.
The centre, and nothing else: every other reply loses against correct play. If they then take the opposite corner, take an edge, not a corner.
On every move: win if you can, block if you must, make a fork if you can, stop the opponent's fork, then prefer the centre, the corner opposite theirs, any corner, and only then an edge. Checked against every possible game, this order never loses.
A move that creates two threats at once — two lines that each need one more mark. The opponent can block only one, so the other wins. Nearly every decisive game ends with a fork.
Not a perfect one: the best you can get is a draw, and that is what the Expert level on this site plays. Weaker programs can be beaten. Here, Normal never blocks, and Hard loses every time to corner, then opposite corner, when you move first.
Yes, but not a winning one. With random play the first player wins 58.5% of games and the second 28.8%. With perfect play the advantage disappears and the result is a draw.