Live · Ready to playboard

Tic-Tac-Toe

🔄Rotate your phone for the best experience
Category
Board
Players
Single player
Avg session
~3 min
Platform
Browser · HTML5
— About the game

About Tic-Tac-Toe

Tic-Tac-Toe is the quick three-in-a-row classic everyone knows. You place your X on a 3×3 grid, the computer answers with an O, and the first to line up three in a row — across, down or diagonally — wins the round.

This version is powered by a perfect AI opponent that never makes a mistake. That changes the goal in a fun way: you cannot beat it, so the real challenge becomes never losing. Play smart and every game ends in a draw; slip up once and the computer pounces. It is a great little brain warm-up that lasts only seconds per round.

Despite its tiny board, Tic-Tac-Toe contains a complete game theory in miniature. There are exactly 255,168 possible games when symmetry is not considered, and only 26,830 unique boards. From any given position, perfect play by both sides always leads to a draw — that result was first proven mathematically in the early 20th century. What that means for you as a player is that the entire challenge of Tic-Tac-Toe is not "can you win?", but "can you find the one or two moves on each turn that do not lose?". Approaching the game with that mindset turns even a casual round into a small puzzle.

This browser version is free, instant and works equally well on phone, tablet and desktop. Rounds last seconds, the reset is one tap, and you can play as many games in a row as you like. The AI difficulty is fixed at "optimal", which is what makes the game a real teaching tool — it never lets you get away with a sub-optimal move, so playing it consistently sharpens your spatial reasoning over time.

— How to play

How to play Tic-Tac-Toe

  • Click any empty square to place X
  • AI plays O with optimal moves
  • Three in a row wins
— Controls

Tic-Tac-Toe controls

Desktop (mouse & keyboard)

Use arrow keys, WASD, the mouse or spacebar where the game requires it. Specific controls match the "How to play" steps above — each step describes the exact input the game expects.

Mobile (touchscreen)

Tap, hold, swipe or drag — whichever your finger naturally does for the action described in the steps. Tic-Tac-Toe is mobile-first and works in portrait or landscape on any modern phone or tablet.

— Strategy & tips

How to win

  • Take a corner or the centre on your first move — never an edge.
  • Always block the AI the instant it has two in a row.
  • Create a "fork" — two winning threats at once — when you can.
  • Watch all three directions: rows, columns and both diagonals.
  • Against perfect play, a draw is a win — protect it.
  • If the AI plays an edge after a corner opening, look for a fork in two moves.
  • When you start at a corner, the AI must respond with the centre or you can force a win.
  • In endgame positions, count your own potential wins on every turn before defending — sometimes attack is the best defence.
— Game features

Why you'll love it

  • Classic 3×3 strategy gameplay
  • Unbeatable, optimal AI opponent
  • Instant rounds — perfect quick break
  • Free to play on any device
— Origin & history

The story behind Tic-Tac-Toe

Tic-Tac-Toe is one of the oldest games in recorded history. Variants of the three-in-a-row format have been found in ancient Egyptian archaeological sites dating to around 1300 BC, and a Roman version called Terni Lapilli used a 3×3 grid that is almost identical to the modern game. The mathematical solution — that perfect play by both sides always results in a draw — was understood by classical game theorists by the early 20th century, and Tic-Tac-Toe became one of the standard early examples used to teach algorithmic search trees and minimax theory in computer science classrooms. The game also has a place in computing history as the subject of OXO, written by A. S. Douglas in 1952 on the EDSAC at Cambridge, which is widely credited as one of the first graphical computer games ever programmed.

— Advanced strategy

Master-level Tic-Tac-Toe

The deepest concept in Tic-Tac-Toe strategy is the "fork" — a move that simultaneously creates two separate threats to win, so that the opponent can only block one of them. Creating a fork is the only way to force a win against a human opponent, and recognising your opponent's forks one move in advance is the only way to avoid losing. A classic forking opening is: you play a corner, the AI plays the centre (correct), you play the opposite corner, the AI plays a third corner (incorrect for them — they should have played an edge), and now you can play an edge that simultaneously threatens two three-in-a-rows. Against the perfect AI in this game you will never reach that position, but learning to spot forks in casual play against humans is one of the most useful pattern-recognition skills the game teaches.

The second key skill is positional value awareness. The centre square participates in four winning lines (one row, one column, two diagonals). Each corner participates in three winning lines. Each edge participates in only two winning lines. That difference is not a small detail — it determines optimal play. The opening move on an edge is a known mistake because it gives away the maximum positional value to the opponent. Once you internalise the asymmetric value of board positions, your move choices in the mid-game also become clearer: when in doubt, play to a square that participates in more lines than your alternatives. That single heuristic is enough to draw most games against most opponents.

— Frequently asked questions

Tic-Tac-Toe FAQ

Can I beat the AI in this Tic-Tac-Toe?

No — the AI uses the minimax algorithm, which is mathematically proven to play perfectly on a 3×3 board. Against perfect play by both sides, every game of Tic-Tac-Toe ends in a draw. The challenge is therefore inverted: rather than trying to win, you are trying to never lose. Achieving a draw consistently against a perfect AI means you have effectively also achieved perfect play yourself, which is a genuine accomplishment.

Why does the AI sometimes seem to make weird moves?

When multiple moves all lead to a forced draw, the AI picks one of them — sometimes it is the most obvious one to a human, sometimes it is not. What looks like a weird move is the AI signalling that all of its options lead to the same outcome, so it does not need to play the move you would have expected. If the AI ever plays a move that looks suspect and you can find a winning continuation, it means there is a hole in the AI implementation rather than a genuine sacrifice — perfect minimax does not blunder.

Is there a way to widen the board to make it more interesting?

Larger Tic-Tac-Toe variants exist — the most famous is Gomoku, played on a 15×15 board with five-in-a-row as the winning condition. Connect Four (which we also have on this site) is another variant, played on a 7×6 grid with gravity-affected pieces. The 3×3 version you are playing is small enough to be fully solvable, which is exactly what makes it useful for teaching strategy and what gives the perfect-AI version its educational value.

— Strategy guides

Read our Tic-Tac-Toe guides

All guides →

Looking for more like this? See our full list of games like Tic-Tac-Toe

— Similar games

You may also like

View all Board