Tic-Tac-Toe
Play free tic-tac-toe in your browser against the computer (easy, medium or unbeatable hard) or with a friend on the same device, with a running score.
- X wins
- 0
- O wins
- 0
- Draws
- 0
- Best unbeaten run
- 0
Click or tap a square. Keyboard: arrow keys to move, Enter or Space to play, keys 1 to 9 (laid out like a phone keypad, 1 at top left) to play directly, N for a new game.
How to play
- Choose a Mode: Against the computer or Two players (you pass the device back and forth).
- Against the computer, pick a Difficulty (Easy, Medium or Hard (unbeatable)) and choose which side You play: X (you start) or O (computer starts).
- Click or tap an empty square to place your mark. X always moves first, then the players alternate.
- The first player to line up three marks in a row, a column or a diagonal wins, and the winning line lights up. If all nine squares fill up without a line, the game is a draw.
- Press New game (or the N key) for another round. Changing the mode, difficulty or side also starts a new game.
The counters under the board keep a running tally of X wins, O wins and Draws in this browser. Best unbeaten run is your longest series of games without a loss against the computer at the selected difficulty. Reset score sets everything back to zero.
Playing with the keyboard
The board is a 3 × 3 group of buttons. Press Tab to enter it, then move with the arrow keys and press Enter or Space to play the highlighted square. You can also press the digits 1 to 9: they are laid out like a phone keypad, so 1 is the top-left square, 5 the centre and 9 the bottom-right square. Every square announces its row, column and content to screen readers.
How the computer plays
- Easy picks any free square at random. It is a relaxed opponent for children or for learning the rules.
- Medium always completes its own line when it can and blocks yours when you threaten to win. Otherwise it plays the best move two times out of three and a random move the rest of the time, so it can be beaten with a well-prepared fork.
- Hard (unbeatable) uses the minimax algorithm: it looks at every possible continuation of the game until the end and picks a move with the best guaranteed result, preferring faster wins. Tic-tac-toe is a solved game: with perfect play on both sides it always ends in a draw. That means the best you can do against Hard is draw every game, which is exactly what the unbeaten run rewards.
Strategy tips
- Start in a corner. As X, a corner opening gives your opponent the most ways to go wrong. The only safe reply for O is the centre.
- Take the centre if you can. The centre square belongs to four possible lines (a row, a column and both diagonals), more than any other square.
- Create a fork. A fork is a move that threatens two lines at once. Your opponent can only block one, so you win on the next turn. Forks are the only way to beat a player who always blocks.
- Block forks in advance. As O against a corner opening, after taking the centre, avoid playing a corner that lets X set up two threats; an edge move that forces X to respond is often safer.
- Always check for an immediate win first, then for an immediate threat to block, before thinking about anything else.
Frequently asked questions
Can I beat the computer on Hard?
No. Hard plays perfectly and tic-tac-toe cannot be won against a perfect player: the best result is a draw. Try Medium if you want to practise winning with forks.
Who moves first?
X always moves first. Against the computer, choose O (computer starts) if you want the computer to open the game.
Is the score saved?
Yes. The tally and your best unbeaten run are stored in your browser’s local storage on this device. Nothing is sent to a server. Clearing your browser data, or pressing Reset score, erases them.
What is the difference between tic-tac-toe and noughts and crosses?
None: they are two names for the same game. “Noughts and crosses” is common in British English, “tic-tac-toe” in North America.
Can two people play on one phone?
Yes. Choose Two players and hand the phone over after each move. The status line under the board always says whose turn it is.
Related tools
- Four in a Row Play Four in a Row free in your browser. Drop discs on a 7 × 6 board against the computer (easy, medium, hard) or a friend, with keyboard controls.
- Memory Match Play a free memory matching game in your browser. Four grid sizes, emoji or shape cards, moves and time tracking, best scores and a 2-player mode.
- Minesweeper Play classic Minesweeper free in your browser. Safe first click, three board sizes, flags by right-click or long-press, chording and keyboard controls.
- Sudoku Play free sudoku online at four difficulty levels. Every grid has exactly one solution, with pencil notes, check, hints, undo and a printable view.