We use cookies
We use cookies and third-party services (including Google AdSense) to personalize content and ads. Learn more
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.
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.
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.
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.
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.
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.
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.
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.
Free games to play with friends online — Tic-Tac-Toe, Connect Four, Checkers and more two-player browser games. No download, just share the link and play.
Free online games for kids — safe, fun and easy. No download, no sign-up, no in-app purchases. Bubble Pop, Snake, Memory Match and more, instant in any browser.
Tic Tac Toe strategy that guarantees a win or tie. Best opening move, every response to opponents attacks, and the fork trick that wins games.
Looking for more like this? See our full list of games like Tic-Tac-Toe →