Tic-Tac-Toe

Tic-Tac-Toe is the classic 3×3 strategy game. Place three Xs or Os in a row to win. Play vs an AI opponent or with a friend in 2-player mode.

Tic-Tac-Toe
Your turn (X)
X: 0O: 0Draws: 0

About Tic-Tac-Toe

Tic-Tac-Toe (also called Noughts and Crosses) is the simplest strategy game most people learn. Two players take turns placing their symbol (X or O) on a 3×3 grid. The first player to get three of their symbols in a row — horizontally, vertically, or diagonally — wins. If the grid fills with no winner, the game is a draw. Tic-Tac-Toe has been mathematically solved: with optimal play from both sides, the game always ends in a draw. Our AI opponent uses a simple but effective heuristic (win > block > center > corner > random), making it impossible to beat with optimal play but beatable by clever traps for human-like difficulty.

How to Play Tic-Tac-Toe

  1. Click any empty cell on the 3×3 grid to place your symbol. X always goes first.
  2. Players alternate turns. In 2-player mode, X and O take turns at the same device. In vs AI mode, you play X and the AI plays O.
  3. Get three of your symbols in a row — horizontally, vertically, or diagonally — to win.
  4. If all 9 cells fill with no winner, the game is a draw.
  5. Press New game to start over. The score panel tracks wins for X, O, and draws.

Tips and Strategy

  • Always take the center on your first move when playing X. The center is part of the most winning lines (4 of 8).
  • When playing O against a center-X, take a corner. Taking an edge against a center-X loses with optimal play.
  • Watch for “fork” threats: positions where you create two simultaneous winning lines so the opponent can only block one.
  • Block any opponent two-in-a-row immediately. Even one missed block ends the game.
  • After taking the center, your safest second move is a corner that creates two open lines.
  • Tic-Tac-Toe with optimal play always ends in a draw, so focus on traps. Look for positions where the opponent must block in a way that creates your fork.
  • In 2-player mode, swap who goes first each round. The first player has a slight advantage.

History and Origin

Tic-Tac-Toe games date back to ancient Egypt around 1300 BCE. Roman versions called “terni lapilli” (three pebbles at a time) have been found scratched into Roman ruins. The English name “Noughts and Crosses” appeared in print in 1864. The American name “Tic-Tac-Toe” likely comes from a 19th-century children’s rhyme. The game was the subject of one of the first AI programs ever written: in 1952, A.S. Douglas built a tic-tac-toe AI for his PhD thesis at Cambridge. Modern Tic-Tac-Toe is “solved” — perfect play from both sides always leads to a draw.

Variations and Game Modes

Variants include 4-in-a-row on a larger grid, Misère Tic-Tac-Toe (first to make 3-in-a-row LOSES), Ultimate Tic-Tac-Toe (a 3×3 grid of 3×3 grids), Wild Tic-Tac-Toe (either symbol on any turn), and Notakto (place only Xs, last to move loses).

Frequently Asked Questions

How do you always win at Tic-Tac-Toe?

You cannot always win — with optimal play from both sides, Tic-Tac-Toe always ends in a draw. You can only win against a player who makes a mistake. The strongest opening is the center followed by a corner threat.

What is the best opening move in Tic-Tac-Toe?

The center is the strongest opening for X. It is part of 4 of the 8 possible winning lines, more than any other cell. Corners are second best (3 lines each), edges are weakest (2 lines each).

Can the AI in this Tic-Tac-Toe be beaten?

Our AI uses a near-optimal heuristic: win > block > center > corner > random. With perfect play it cannot lose, but it can be tricked into draws. If the AI ever loses, it is a heuristic gap, not random chance.

Is Tic-Tac-Toe solved?

Yes. Tic-Tac-Toe was mathematically solved decades ago. With optimal play from both players, every game ends in a draw. There is no winning strategy that beats a perfect opponent.

Can children play Tic-Tac-Toe?

Yes. Tic-Tac-Toe is suitable for ages 4 and up. The simple rules and quick games make it ideal for teaching basic strategic thinking, though kids will need adult help to discover the optimal strategy.

How long does a Tic-Tac-Toe game take?

Each game lasts 30 seconds to 2 minutes. The board fills in at most 9 moves. Many games end earlier with a 3-in-a-row.

What is a “fork” in Tic-Tac-Toe?

A fork is a position where you create two simultaneous winning threats. Since the opponent can only block one, you win on the next move. Forks are the only way to beat a defensive opponent.

How does 2-player mode work?

In 2-player mode, X and O take turns clicking on the same device. There is no AI involved. The score panel tracks wins for both X and O across multiple games.


Skip to Accessibility Panel