Tic-Tac-Toe – Play the Computer, Up to Unbeatable
Take turns placing X and O on a 3×3 grid, and be the first to line up three of your marks in a row, column or diagonal. Choose from three computer levels; "Unbeatable" uses minimax to search every position, so the best you can do against it is a draw. You can also choose to move first or second. Want a bigger grid? Try Four in a Row.
🔒 Runs in your browser · Your data is never sent to a server
How to use
- Choose the computer level (Easy, Normal or Unbeatable) and your side (first as X, or second as O). A new game starts when you choose.
- Click (or tap) an empty square to place your mark. The computer replies right after.
- Line up three of your marks in a row, column or diagonal to win. The winning three are highlighted. If all nine squares fill up, the game is a draw.
- Press "Undo" to take back a move, or "New game" to start over.
Notes
- Everything runs in your browser and nothing is sent to a server. The computer’s moves are also calculated in your browser.
- Easy picks a random empty square. Normal wins if it can, blocks your winning move if needed, and otherwise plays at random.
- Unbeatable searches every possible continuation, so it never loses from either side. You can only win against Easy and Normal.
- When several moves are equally good, the computer picks one at random, so the same position will not always play out the same way.
- Undo takes back your last move together with the computer’s reply. Game progress is not saved; reloading the page starts a new game.
- With a keyboard, Tab to a square and press Enter or Space to place your mark.
Glossary
Tic-Tac-Toe (Noughts and Crosses)
A two-player game on a 3×3 grid. Players alternate placing X and O, and the first to get three in a row, column or diagonal wins. With perfect play from both sides, the game is always a draw.
Minimax
A search method that assumes you pick the move with the highest score and your opponent picks the one with the lowest, then looks through the following positions to choose the best move. Tic-Tac-Toe is small enough to search to the end.
Fork
A position where you threaten to complete two lines at once. Your opponent can block only one, so the game is almost decided.
FAQ
Is there a winning strategy in Tic-Tac-Toe?
With perfect play from both sides, the game is always a draw. If the first player opens in a corner or the center and the second player answers correctly, nobody wins. Wins come from mistakes, such as taking an edge too early or allowing a fork.
Can I beat the Unbeatable level?
No. Unbeatable searches every position with minimax, so it never loses as first or second player. The best you can do is draw. Choose Normal if you want to practice winning.
What is the difference between Normal and Easy?
Easy picks a random empty square. Normal takes a winning move if it has one, blocks your winning move if you have one, and otherwise plays at random. That means you can beat it by creating a fork, two threats at once.
Is it better to go first or second?
Going first is a slight advantage, and starting in a corner or the center is hard to lose with. As the second player, take the center when the opponent opens in a corner. In this tool the first player is X and the second is O.
Is my game saved?
No. A game lasts only while the page is open; reloading starts a new one. The tool runs entirely in your browser and sends no data to a server.
Share this page
