Tic Tac Toe
Share
You (â)
0
Draws
0
Computer (â¯)
0
You to move
Tic tac toe is the three-by-three game of X and O that almost everyone learns as a child. This version plays in your browser with no download: take on the computer, try to survive the unbeatable impossible mode, or play two player on one screen.
How to play tic tac toe
Two players take turns placing a mark in an empty square. X always goes first. The first player to get three marks in a row, horizontally, vertically or diagonally, wins. If all nine squares fill up with no line, the game is a draw.
Choose a mode above the board:
- vs Computer plays a sensible game but slips now and then, so you can win with good tactics. There is a dedicated vs computer page too.
- Impossible never loses. The impossible tic tac toe page explains how it works.
- 2 Players lets you play a friend on the same device. See 2 player tic tac toe.
The first move alternates between games, so the computer gets to start every other round.
Tic tac toe strategy
Tic tac toe is a solved game: with perfect play from both sides it always ends in a draw. Winning means setting traps your opponent misses.
- Take a corner first. A corner opening gives your opponent the most ways to go wrong. If they reply anywhere except the centre, you can force a win.
- Answer a corner with the centre. When your opponent opens in a corner, the centre is the only safe reply.
- Build a fork. A fork is a move that creates two lines of two at once. Your opponent can only block one, so you win with the other.
- Block forks before they happen. If your opponent could create a fork next turn, block that square, or force them to respond to a threat of your own.
- Win before you block. Always check whether you can complete a line before blocking theirs.
Against the normal computer, the corner opening followed by a fork wins regularly. Against impossible mode, the best result is a draw, and a draw is a perfect game.
Bigger boards and 3D
The classic 3x3 board is small enough for players to memorise. Larger boards change the game:
| Board | Win with | Winning lines | What changes |
|---|---|---|---|
| 3x3 | 3 in a row | 8 | Solved, always a draw with perfect play |
| 4x4 | 4 in a row | 10 | No centre square, blocking dominates |
| 5x5 | 4 in a row | 28 | Lots of room for double threats |
| 3D 4x4x4 | 4 in a row | 76 | Lines run through layers and the cube |
3D tic tac toe is the hardest to read. Lines run within a single layer, straight down through all four layers, and diagonally from one corner of the cube to the opposite one. Most losses come from a space diagonal that nobody noticed.
A little history
Games of three in a row go back thousands of years; boards scratched into stone have been found across the ancient world. The name tic tac toe, also called noughts and crosses, became common in the nineteenth and early twentieth centuries. In 1952 it became one of the first computer games, played on a room-sized machine at the University of Cambridge.
It is still a useful teaching game. Small enough to analyse fully, it is often the first game programmers write an AI for, using the same minimax algorithm the impossible mode uses here.
Frequently asked questions
Can you always win tic tac toe?
No. With perfect play from both sides, tic tac toe always ends in a draw. You can only win if your opponent makes a mistake.
What is the best first move in tic tac toe?
A corner is the strongest opening because it gives your opponent the most ways to go wrong. The centre is the safest reply to a corner opening.
Can I play tic tac toe with a friend?
Yes. Choose 2 Players and take turns on the same screen. The first move alternates between games so both players get to start.