Play tic tac toe online
Get three in a row to win: tap a square or use your keyboard. Play the computer at three levels or a friend on the same device – the score is kept for you.
How it is calculated
How to play tic tac toe
Tic tac toe (also called noughts and crosses or Xs and Os) is played on a 3 × 3 grid. Two players take turns placing their mark, X or O. The first to get three marks in a row – across, down or diagonally – wins. If all nine squares are filled without a line, the round is a draw.
- Choose a mode: “vs computer” (you play X) or “2 players” on one phone, tablet or computer.
- Who starts: you, the computer, or take turns – with “Take turns” the other side opens every new round.
- Pick a square: tap or click it; on a keyboard use the arrow keys and Enter, or press 1–9.
The three computer levels
- Easy: the computer plays a random empty square – good for kids and warming up.
- Medium: it wins when it can and blocks your open two-in-a-row, otherwise it plays randomly. A fork (two threats at once) beats it.
- Unbeatable: the computer uses the minimax algorithm to search every possible continuation to the end and always picks a best move. The best you can get is a draw.
Why does perfect play always end in a draw?
Tic tac toe is a solved game: if both sides play without mistakes, nobody wins. There are only 765 essentially different positions, so a computer can check them all in a split second – which makes the game a classic first example of game AI.
Tips to win more often
- Open in a corner. If your opponent does not answer in the centre, you can force a fork.
- If they do take the centre, play the opposite corner – weaker players often go wrong here.
- Playing second against a corner opening, always take the centre, or you will lose.
Score and privacy
Wins, losses and draws are counted separately for “vs computer” and “2 players” and stored in your browser’s localStorage. Nothing is sent to a server. The computer’s random choices come from the browser’s cryptographic random number generator.
More games: Hangman, flip a coin or the score keeper for game night.
Frequently asked questions
Can you beat the unbeatable level?
No. It searches every possible game and always plays a best move. With perfect play you can reach a draw – that is the best anyone can do against perfect tic tac toe.
How do I beat the medium level?
Set up a fork: start in a corner and create two open lines of two at the same time. The computer can only block one of them.
Can two people play on one device?
Yes. Choose “2 players” – X and O take turns on the same phone, tablet or computer. The score for this mode is kept separately.
Who starts with “Take turns”?
The side that did not start the previous round. The very first round starts with X.
How do I play with the keyboard?
Arrow keys move the selection and Enter or Space places your mark. Faster: press 1–9, where 1 is top left and 9 bottom right. When a round is over, Enter starts a new one.
Is my score saved?
Yes, only in your browser (localStorage). It survives a page reload; “Reset score” sets it back to 0.
How many possible games of tic tac toe are there?
There are 255,168 possible games, but only 765 essentially different positions once rotations and reflections are merged.
Sources and legal basis
As of:
Related tools
- Play hangman onlineFree hangman game in your browser: 3,000 common English words in three levels, or enter your own secret word for a friend. Keyboard and touch, no sign-up.
- Flip a coin: heads or tails?Flip a coin online: heads or tails, 1 to 100 coins per toss, live stats with share and longest streak. Fair cryptographic randomness, no sign-up.
- Roll dice online: d6, d20 and moreOnline dice roller: roll 1–10 dice with 4, 6, 8, 10, 12 or 20 sides, d6 with dots, total, roll history and exact odds. Fair cryptographic randomness.
- Online score keeperFree online score keeper and score counter for board and card games: rounds, running totals, rankings, target score and undo. Saved locally in your browser.
- Play the 2048 game onlinePlay 2048 free in your browser: swipe or use the arrow keys to merge tiles until you reach 2048. With best score, one-step undo and your game saved.
- Aim Trainer OnlineFree online aim trainer: hit 30 targets against the clock or as many as you can in 30 seconds. Three target sizes, accuracy and average time per target.