Skip to content
Free browser games for computer, phone and tablet — no downloads.

Tic-tac-toe online

Three in a row against the computer or a friend, right in your browser

  • Classics
  • Board games
  • Two players

Tic-tac-toe is probably the first strategy game most of us ever learn: a square split into nine cells, two players — one with X, the other with O — and the goal of getting three in a row before the other does. It fits on a napkin, a blackboard or the sand, and here it fits on your screen with no paper or eraser needed.

In this version you play the computer on three levels or call someone over to play together on the same phone, tablet or computer. The score is saved in your browser, the first move alternates every game, and you can play with a mouse, a finger or just the keyboard. Below the game you will find the rules, the strategy that prevents any defeat and a little of the long history of this pastime.

Full disclosure: Tic-tac-toe is made by the same team that runs GamesToPlay.

Tic-tac-toe rules

The rules fit in four sentences, which is why the game has survived for centuries:

  • The board is a 3 × 3 grid with nine empty cells at the start.
  • Players take turns, each marking one free cell at a time: one always with X, the other always with O. Nobody may pass or mark a cell that is already taken.
  • The first to get three of their marks in a row wins — horizontally, vertically or along one of the two diagonals. There are eight possible lines.
  • If all nine cells are filled and nobody has completed a line, the game is a draw (a "cat’s game"). Between two careful players, almost every game ends this way.

How to play here

  1. Choose the mode at the top of the game: 1 player (against the computer) or 2 players (both on the same device).
  2. Against the computer, choose the difficulty: easy, medium or hard. You always play the red X; the computer plays the magenta O.
  3. Tap or click a cell to mark it. On a keyboard, keys 1 to 9 mark the cells in reading order (1 is the top-left corner, 9 the bottom-right one), the arrow keys move around the board, Enter marks and N starts a new game.
  4. The first move alternates: against the computer you open the first game and it opens the second, and so on; with two players, X and O take turns starting.
  5. Keep an eye on the score below the board. It is stored in your browser (separately for each difficulty) and can be reset at any time. The full-screen button makes the board bigger; the speaker button turns the sounds on and off.

Strategy: how never to lose (and when you can win)

Tic-tac-toe is a "solved" game: with both sides playing without mistakes, every game ends in a draw. So the strategy has two halves — never give your opponent a chance to win, and take advantage when they slip.

  • Check the threats first. Before every move, see whether you can complete a line right now; if not, see whether your opponent can — and block it. Most losses come from skipping this step.
  • Open in a corner. The corner is the opening that gives the other player the most ways to go wrong: if they do not answer in the centre, there is a forced path to victory. The centre is a safe opening too.
  • When replying, take the centre. If your opponent opened in a corner, the only reply that guarantees a draw is the centre. If they opened in the centre, reply in a corner — answering on an edge hands them the win.
  • Set up a fork. A fork is a move that creates two threats at once: your opponent can block only one, and the other becomes your line. Nearly every tic-tac-toe win comes from a fork.
  • Defuse their fork. When your opponent is one move away from creating two threats, the best block is often to make a threat of your own, forcing them to answer instead of completing the fork.
  • Against the hard level, aim for a draw. It plays perfectly and never loses: every drawn game against it is a game with no mistakes on your side.

The three computer levels

  • Easy: plays any free cell and only takes a ready-made win half of the time. Good for children and for learning the rules.
  • Medium: always completes its own line when it can and always blocks yours; otherwise it sometimes plays the perfect move and sometimes a random one. A well-built fork beats it.
  • Hard: works out every possible continuation to the end of the game and always picks a perfect move. It never loses — the best possible result is a draw.

History and trivia

Three-in-a-row games are very old. People often point to boards scratched on roof tiles in ancient Egypt and to the Roman terni lapilli, in which each player had only three pebbles and had to move them around the board to make a line. The pencil version spread in the nineteenth century and picked up a different name almost everywhere: noughts and crosses in Britain, tic-tac-toe in the United States, tres en raya in Spain, gato in Mexico and Chile, ta-te-tí in Argentina and Uruguay and jogo da velha — "the old woman’s game" — in Brazil and Portugal.

The game also has a place in computing history: in 1952 Alexander S. Douglas programmed OXO, a tic-tac-toe game against the EDSAC computer at the University of Cambridge, and it is remembered as one of the first video games with a picture on screen.

Because the board is so small, every possible game can be counted: there are 255,168 of them, and in none of them can the first player force a win against a perfect opponent.

Variations for when 3 × 3 gets too easy

  • Reverse tic-tac-toe (misère): whoever makes three in a row loses. The strategy changes completely — and a draw is still the perfect result.
  • Three pieces: each player has only three marks; once they are placed, you move one at a time to a free neighbouring cell, as in terni lapilli. Games no longer have to end in a draw.
  • Bigger boards: on a 4 × 4 grid you need four in a row; on large grids with five in a row the game becomes gomoku, a classic Japanese strategy game.
  • Ultimate tic-tac-toe: nine small boards inside a big one. The cell you play in decides which small board your opponent must play in next, and winning three small boards in a row wins the game.

Who it is for

Everyone. The game has no ads on the board, no purchases, no chat and no sign-up, and it does not use your microphone, camera or location. It stores only the score, the mode, the difficulty and your sound setting in your browser — none of it leaves your device. Details in the privacy policy.

Frequently asked questions

Can you always win at tic-tac-toe?

No. If neither player makes a mistake, every game ends in a draw. You only win when your opponent slips — usually by letting you set up a fork with two threats at once.

What is the best first move?

Starting in a corner gives your opponent the most chances to go wrong: if they do not reply in the centre, you can force a win. The centre is also safe. An edge is the easiest opening to neutralise.

Can I beat the computer on hard?

No: it calculates every continuation and never loses. Against it, the goal is to draw every game. To practise winning, use medium, which blocks your lines but does not see forks coming.

Can two people play?

Yes. Choose "2 players" and pass the device back and forth (or share the mouse): X and O take turns, and the first move switches every game.

Is the score saved?

It is kept in your browser, separately by mode and difficulty, until you reset it or clear the site data. Nothing is sent to any server.

Do I need to download anything or sign up?

No. The game opens right here on a computer, phone or tablet, and works in English, Portuguese and Spanish.