Games & scoring / Two players

Tic-tac-toe: Play a Friend or the Computer

Play tic-tac-toe on a three-by-three board against a friend or the computer. Choose random easy play or unbeatable hard play, and go first or second.

Tic-tac-toe: Play a Friend or the Computer: Checks all eight winning lines after each turn. Easy mode picks a random empty square. Hard mode searches possible continuations and chooses an optimal move, so it never loses from a fresh game. Winning streaks and their local best are tracked for the chosen opponent and mark. Runs 100% locally in your browser with zero server file uploads.

Runs
In your browser
Cost
Free · no sign-up
Availability
Ready to use
Tic-tac-toeLocal processing

Runs entirely in your browser

Winning streak: 0Best streak: 0
X to play

Choose a square with a click, tap or Enter. Arrow keys move focus. Hard mode searches every continuation and cannot be beaten from a fresh game.

Rules and strategy

Win immediately if you can, then block an immediate opposing win. A fork threatens two different winning lines at once. The centre and corners often provide more ways to create or stop forks than an edge square.

A full board with no completed line is a draw. Perfect play from an empty board is a draw; hard mode plays for that result or a win if the other player makes a mistake.

History

Noughts and crosses became an early computer game in 1952, when Cambridge researcher Alexander Douglas made a version for EDSAC. The Computer History Museum's 1952 timeline documents it under the name OXO. Timeline: https://www.computerhistory.org/timeline/1952/. This board uses original CSS and text marks.

How to use it

  1. Choose a friend, an easy computer or a hard computer. Against the computer, choose X to go first or O to go second.
  2. Take turns placing marks in empty squares.
  3. Complete a row, column or diagonal of three marks to win. If all squares fill without a winner, the game is a draw.

Privacy & limitations

Your moves stay in your browser. Best streaks are saved locally on this device.

Related tools

Frequently asked questions

Can I beat hard mode?

From a fresh game, no. Correct play by both sides leads to a draw. Easy mode chooses random moves and can make mistakes.

Can two people use the same device?

Yes. Choose A friend, then alternate X and O on the same board.

How do I use the keyboard?

Use Tab to focus a square, arrow keys to move between squares and Enter or Space to place your mark.

Who moves first?

X always moves first. Choose O against the computer to let it begin.

Free tool · runs in your browser · no account required