Tic-Tac-Toe

Play noughts and crosses against an Easy or unbeatable Hard computer, or against a friend on the same device.

Your turn (X)

How to play

Take turns placing X and O on the 3×3 grid. The first to line up three in a row, column or diagonal wins.

Two modes, two levels

Play the computer on Easy or Hard, or choose 2 Players and pass the device to a friend.

Runs in your browser

No download and no account. The score tally lasts for your current visit.

How to play Tic-Tac-Toe

Tic-Tac-Toe, also called noughts and crosses, is played on a grid of three rows and three columns. One player uses X and the other uses O. Players take turns placing one mark in any empty square. The first player to get three of their marks in a straight line, across a row, down a column or along either diagonal, wins the round. If all nine squares fill up without a line of three, the round is a draw. On this page X always moves first.

Screenshot of the Preslo Tic-Tac-Toe game, free and running in a web browser
Tic-Tac-Toe on Preslo (Games) — free, private and no sign-up needed.

Game modes

  • Vs Computer: you play X and move first, and the computer plays O. While the computer is choosing its move the board ignores clicks, so you cannot accidentally place two marks in a row.
  • 2 Players: two people share one screen. The status line shows whose turn it is, and the result reads "X wins!" or "O wins!". Hand the device over after each move.
  • New Round clears the board at any time. Switching mode or difficulty also starts a fresh round and cancels any move the computer was about to make.

Below the board, a tally counts wins for each side and draws during your visit. It resets when you switch between Vs Computer and 2 Players, or when you reload the page.

Computer difficulty

Hard uses the minimax algorithm, which looks ahead through every possible continuation of the game. It never loses: the best you can do against it is a draw. It also prefers winning quickly to winning slowly, so if it has a winning line available it takes it straight away instead of dragging the game out. When several moves are equally good it picks one at random, so games do not always look the same.

Easy is meant for younger players and warm-ups. It always completes three in a row if it can, blocks your winning move only about half the time, and otherwise plays a random empty square. You can beat it regularly with a little planning.

Strategy tips

  1. Start in a corner or the center. The center square belongs to four possible lines and each corner to three, while an edge square belongs to only two.
  2. Block first, then attack. Before each move, check whether your opponent has two in a line with the third square empty. If so, block it unless you can win immediately.
  3. Create a fork. A fork is a move that makes two separate threats at once, so your opponent can only block one. Example: X takes the top-left corner, O answers with an edge such as top-middle, X takes the center and threatens the diagonal. After O blocks bottom-right, X plays bottom-left and threatens both the left column and the bottom-left to top-right diagonal.
  4. Answer a corner with the center. If your opponent opens in a corner and you reply on an edge, you can be forced into a fork. Taking the center is the safe reply.
  5. Against Hard, aim for a draw. Tic-Tac-Toe is a solved game: with perfect play from both sides it always ends in a draw. Every draw against Hard means you made no mistakes.

A little history

Games built around getting three marks in a row on a small grid are very old, and similar games have been played in many countries under different names. In Britain and much of the Commonwealth the game is known as noughts and crosses, while tic-tac-toe is the usual name in North America. Because its rules are so simple, it was one of the first games ever played against a computer: OXO, written by A. S. Douglas in 1952 on the EDSAC computer at the University of Cambridge, let a person play noughts and crosses against the machine. Today the game is still a common first example when people learn about search algorithms such as minimax.

Frequently asked questions

Can I beat the computer on Hard?

No. Hard mode uses the minimax algorithm and plays perfectly, so the best possible result against it is a draw. Easy mode makes deliberate mistakes and can be beaten.

Who goes first?

X always moves first. In Vs Computer mode you are X, so you always have the first move. In 2 Players mode the player using X starts each round.

Can I play against a friend on the same device?

Yes. Choose 2 Players and take turns tapping the board. The status line shows whose turn it is and announces the winner as X or O.

What happens if I click while the computer is thinking?

Nothing. The board ignores clicks during the computer's turn, which lasts less than half a second, so your next move only counts once the computer has played.

Is Tic-Tac-Toe always a draw?

If both players make no mistakes, yes. Tic-Tac-Toe is a solved game and perfect play from both sides always ends in a draw. Wins happen when one side misses a block or falls for a fork.

Is the score saved?

The tally of wins and draws lasts for your current visit only. It resets when you change between Vs Computer and 2 Players or reload the page, and nothing is uploaded.

Is Tic-Tac-Toe free?

Yes. It is free to play in your browser with no download, no signup and no account.

More games

Rock Paper Scissors · Memory Match · Hangman · Sudoku