Math & AI
How Many Possible Tic Tac Toe Games Are There?
There are 255,168 legal complete Tic Tac Toe games under standard rules. Learn why games, positions, and symmetry produce different correct totals.

Jump to section
There are 255,168 legal complete games of classic Tic Tac Toe when X starts, play stops at the first win or a full board, and a different move order counts as a different game. Other totals are also correct when they answer a different question.
The short answer depends on the definition
The OEIS entry A061526 records 255,168 as the number of complete games of 3×3 Tic Tac Toe. The important part is the definition: complete legal game histories, not every possible filling of nine cells.
That definition matters. “How many games?” can mean:
- every legal move history;
- every reachable board position;
- games or positions after rotations and reflections are treated as equivalent; or
- every way to fill all nine squares, even when play should already have stopped.
Why 9! is too large
If all nine squares were filled in order, there would be 9! = 362,880 possible orders. UC Berkeley’s computer-science lesson uses that factorial as an upper bound, then explains why it is not the legal game total: many games end before the board is full.
Once a player makes three in a row, the game ends. A sequence that adds more marks after that win is not a legal continuation.
The commonly reported totals
| Question | Count | What it includes |
|---|---|---|
| All nine-square orders | 362,880 | Every permutation, including post-win continuations |
| Legal completed games | 255,168 | Move histories that stop at a win or full board |
| Symmetry-reduced games or positions | Depends on the enumeration | Rotations and reflections are grouped only after the object being counted is defined |
Symmetry-reduced totals should not be compared with a raw 3^9 = 19,683 cell-filling count, which includes impossible boards. A source must state whether it is counting histories or positions before a symmetry total can be interpreted.
Games are not the same as positions
A game is a history. A position is a board state. Two different move orders can produce the same arrangement of X and O marks, so the game-tree count is larger than the number of reachable positions.
This distinction matters for programs. A game-tree search follows possible histories. A position cache stores a board once, even if several histories reach it. Symmetry reduction can store one canonical representative for rotations and reflections, but it must be applied carefully because some boards have more symmetry than others.
What a legal enumeration does
Start with an empty board and let X and O alternate. For every empty square, place the current mark, test for a win, and stop the branch if the game is over. If the board is full without a winner, count a draw. Otherwise recurse to the next player and undo the move before exploring the next square.
That procedure makes the assumptions visible: X starts, turns alternate, three in a row wins, and no move follows a completed line. Change any of those rules and the answer changes.
Why the number is useful
The full tree is small enough to enumerate, which makes Tic Tac Toe a clear example for minimax, caching, symmetry, and testing. But the total does not tell you which move is best. For that, use the Tic Tac Toe solver and inspect the result of the current position.
For the connection between exhaustive search and a draw, read Is Tic Tac Toe a Solved Game?. The source-backed answer is not just “255,168”; it is “255,168 under these rules, with different totals when the counting object changes.”