Tic Tac Toe - Play Online vs Computer or Friend

Play Tic Tac Toe online against an unbeatable AI (Minimax algorithm) or a friend. Track wins, losses, and draws with score history.

Player X's turn
X Wins: 0
Draws: 0
O Wins: 0

About this calculator

Play Tic Tac Toe against a friend or the computer at easy or unbeatable level, and track wins, losses and draws.

Simple, quick and a nice look at game theory.

How to use it

  1. Choose 2 players, Easy or Hard.
  2. Click a square to place your mark.
  3. Press New Game to play again.

Strategy

With perfect play from both sides, Tic Tac Toe always ends in a draw. The hard AI uses minimax, which explores every possible continuation and picks the move with the best guaranteed outcome, so you can't beat it. If you go first, take a corner (or the centre); if the opponent starts in a corner, take the centre. Look for forks: moves that create two winning threats at once.

Worked example

Total positions

Possible games255,168
Outcomes with perfect playDraw

Tips and common mistakes

  • Take the centre or a corner first.
  • Block the opponent's two-in-a-row.
  • Create forks.
  • Don't open on an edge.
  • Try Easy mode to practise forks.

Frequently asked questions

Can I win against the hard AI?

No, the best you can do is draw.

What is minimax?

An algorithm that picks moves assuming best play.

Who wins with perfect play?

Nobody; it's a draw.

Best first move?

A corner or the centre.

Is it free?

Yes.

Is my score saved?

Only in this session.

Related tools