Tic Tac Toe: play free online against the computer or a friend

Tic Tac Toe is a two-player game of X and O on a 3×3 grid. On this page you can play it online for free in your browser against the AI on Easy, Medium or Hard, as X or O, or with a friend on the same device.

How to play

  1. Tap an empty square to place your X or O.

  2. Get three in a row across, down or diagonally to win.

  3. Make two threats in one move. Only one can be blocked.

More games

On this page: Rules · Easy, Medium and Hard · Buttons and scores · How to win · FAQ

How to play Tic Tac Toe

Players take turns marking an empty square, one with X and the other with O, and whoever gets three marks in a row first wins. In British English the game is called noughts and crosses. That name first appeared in print in 1858, and in 1952 a version called OXO, written for the EDSAC computer at the University of Cambridge, became one of the first known video games.

  1. Each turn, put your mark in one empty square. A marked square stays marked.
  2. Three in a row wins. The row can run across, down or corner to corner, so the board has 8 winning lines.
  3. When all nine squares are full and neither side has a line, the game is a draw. Players call that a cat's game.
Empty Tic Tac Toe board on grid paper with X to move, the score You 0, Draws 0, AI 0, Undo and New game buttons above, and vs AI, 2 Players, Classic, Easy, Medium, Hard and Play as X or O below
A new game against the AI on Medium, the level the page opens with.

Play against the AI or with 2 players on one device

With vs AI picked, you play the computer. You are X unless you pick O next to Play as; that switch waits for the next game, and the screen shows "from next game" until it starts. With 2 Players picked, two people share one phone, tablet or computer, and the status line says whose turn it is. Both players need to be at the same device, because the page can't connect you to someone on another one.

Who moves first

The rules don't say who starts. Here, X opens the first game, and then the first move changes sides with every new game, including the new game you get when you switch mode or level. If you keep the same mark against the AI, it opens every second game.

Easy, Medium or Hard: how the AI plays

The level decides how the AI picks its square. It answers no faster than 0.35 seconds, so you can see its move land. The level is not saved: the page opens on Medium, unless you arrive from another board's page, which passes its level on. Changing the level starts a new game.

LevelHow the AI picks a squareCan you beat it?
EasyAny empty square, at random.Yes. It blocks you only by luck.
MediumCompletes its own line if it can, then blocks yours, and otherwise picks at random.Yes. It can't see a fork coming.
HardLooks at every move to the end of the game and takes a best one, picked at random when several are equal.No. A draw is the best you can do.

Hard never loses on this page. The site's tests play every possible answer against it, with Hard moving first and moving second, and it loses none of those games. Medium loses often: when we had a perfect player open 2,000 games against Medium, the perfect player won 1,552 of them (78%) and drew the rest. The exact count changes from run to run because both sides pick some moves at random.

Undo, New game and scores

  • Undo takes back your last move. Against the AI it also removes the AI's reply if it has made one, so it is your turn again. In 2 Players it takes back one move at a time. Once a game is over, Undo is off.
  • New game clears the board and starts the next game right away.
  • The Classic button opens the board list: Infinity, 4×4, 5×5, 6×6, 7×7 and 100×100. Each one opens its own page, such as Infinite Tic Tac Toe, where each side keeps only 3 marks, or Tic Tac Toe 100x100, where you need 5 in a row.
  • The question mark button lists the rules for the board you are on, and the speaker button turns sound on or off. The page remembers the sound setting.
  • On a keyboard, press Tab to reach the board, move with the arrow keys and press Enter or Space to play a square.

The score line shows wins for each side and the draws. It is kept in this browser, with one score for each level and one for 2 Players on every board except 100×100, and it is still there the next time you open the page. The Scores button, with the bar chart icon, opens every saved score, one board per tab. There is no account, and if your browser blocks site storage, the score is not kept.

Scores on this device panel showing Classic, 2 Players with X 1, Draws 0, O 0, tabs for Classic, Infinity, 4×4, 5×5, 6×6 and 7×7, and rows for Easy, Medium, Hard and 2 Players
The Scores panel after one 2 Players game won by X.

How to win at Tic Tac Toe

Tic Tac Toe is a solved game: if neither player makes a mistake, it ends in a draw. You win only when the other player makes one, so the tips below help you set up those chances and avoid mistakes of your own.

We counted every possible game with this page's rules code, from the empty board until someone wins or the board fills, with X moving first. There are 255,168 of them. X wins 131,184, O wins 77,904, and 46,080 end in a draw.

SquareWinning lines through it
Center4
Each corner3
Each edge2

First moves

All nine first moves lead to a draw with perfect play. They differ in how many ways the other player can go wrong. We checked every reply with a perfect search on this page's rules code:

  • After a corner opening, the center is the only reply that doesn't lose. That is why a corner is a good first move against a weaker player.
  • After a center opening, any corner is safe. An edge reply loses.
  • After an edge opening, four replies are safe: the center, either corner beside that edge, or the edge across from it.

On every turn

  1. Finish three in a row if you can.
  2. If the other player has two in a row with the third square empty, block that square.
  3. If neither applies, look for a fork. A fork is one move that makes two lines that each need one more mark. The other player can block only one of them.
2 Players game with X in the top-left, center and bottom-left squares, O in the top-middle and bottom-right squares, and O to move
A fork: X threatens the middle-left square and the top-right square, and O can cover only one.

Medium plays steps 1 and 2 but not step 3, which is how you beat it. In the game above, O blocked the middle-left square and X finished the diagonal.

Pen line through three X marks on the diagonal from bottom-left to top-right, with X wins! and the score X 1, Draws 0, O 0
X wins on the diagonal after O blocked the other threat.

Tic Tac Toe FAQ

Can I play Tic Tac Toe online for free?

Yes. Tic Tac Toe on this page runs in your web browser for free, with no account and nothing to download. You play the AI or a friend on the same device; the page can't connect two devices.

Can I play Tic Tac Toe with a friend?

Yes, on the same phone, tablet or computer. Pick 2 Players and pass the device between turns. There is no way to play someone on another device from this page.

Can you beat the AI?

On Easy and Medium, yes. Medium misses forks, so a move that makes two threats at once beats it. Hard plays perfect moves and never loses, so the best you can get against Hard is a draw.

Can I play as O against the AI?

Yes. Pick O next to Play as. The change starts with the next game, and the screen says "from next game" until then.

Who goes first in Tic Tac Toe?

The rules don't fix it. On this page X moves first in the first game, and after that the first move switches sides with every new game.

Is Tic Tac Toe a solved game?

Yes. With perfect play from both sides it ends in a draw. Counted with this page's rules code, there are 255,168 possible games from the empty board to the end.

What is a cat's game in Tic Tac Toe?

A cat's game is a draw: all nine squares are filled and nobody has three in a row.

Does the game save my score?

Yes, on this device only. Every board except 100×100 keeps one score per level and one for 2 Players, and the scores stay after you close the page. If your browser blocks site storage, nothing is saved.

Last checked on : we played Classic vs AI and 2 Players in Chrome at 1280×800, counted the games and safe replies above with this page's rules code, and ran the site's rule and AI tests (33 of 33 passed).

Sources, read on November 16, 2026: Wikipedia, "Tic-tac-toe" (the name noughts and crosses and its first print use in 1858, OXO in 1952, a draw with best play, no agreed rule for who plays first); Wiktionary, "cat's game".

Rate this game

Your rating