Back to All Games

Tic-Tac-Toe

NEW
StrategyEasyStrategyLogicClassic
Won 0Lost 0Draw 0
Your turn (X)

Tap a square to place your X. Hard mode is unbeatable - switch to 2 Players to play a friend!

Place Mark
Tap a Square
Goal
Three in a Row
Modes
vs Computer / 2 Players
Difficulty
Easy / Medium / Hard

Works on both desktop and mobile. Tap or click to play.

About This Game

Play Tic-Tac-Toe free online - against the computer or 2-player on one device. Get three in a row to win. Easy, Medium, and unbeatable Hard AI.

How to play Tic-Tac-Toe

Objective: Get three of your marks in a row across, down, or diagonally before your opponent does, or force a draw against the unbeatable Hard computer.

You always play X and always move first. Tap any of the nine squares to place your X, then the computer places its O and control returns to you. The grid has three rows, three columns, and two diagonals, giving eight possible winning lines. The first side to fill any one of those eight lines with three matching marks wins, and the winning line lights up green when it happens.

In vs Computer mode you pick a difficulty before or during play. Easy makes the computer choose a square completely at random. Medium plays a random square half the time and plays perfectly the other half. Hard runs a full look-ahead every turn, so it never makes a mistake. Switching difficulty immediately starts a fresh board, so change it between games rather than mid-match.

Your X squares appear in cyan and the computer's O squares in amber. A filled square cannot be tapped again, and squares are locked while the status line reads Computer thinking, which lasts a fraction of a second after each of your moves. When neither side completes a line and all nine squares are full, the game ends in a draw and shows It's a draw.

Switch to 2 Players to hand the device back and forth with a friend. X moves first, then O, alternating each turn on the same screen, with no computer and no difficulty setting. The Won, Lost, and Draw counters below the board only track vs Computer results; they are saved in your browser between visits and are not recorded during two-player games.

Tips and strategy

Take a corner or center first

Against Easy or Medium, opening in the center or a corner gives your X the most lines to build toward. The center touches four winning lines, more than any edge square, so it creates the widest set of follow-up threats.

Build two threats at once

Set up a position where your next move could complete two different lines. The opponent can only block one, so the other wins. This fork is the only reliable way to beat the Easy and Medium computer instead of waiting for its random errors.

Block before you attack

Each turn, scan the eight lines for any where the opponent already has two marks and an empty square. If one exists, fill that square first. Ignoring an open two-in-a-row hands the computer an instant win on its next O.

Aim for draws on Hard

Hard uses full look-ahead and cannot be beaten, so a draw is the best result available. Respond to every two-in-a-row threat and avoid leaving two open lines at once. Perfect defense keeps padding your Draw counter instead of your Lost total.

Farm wins on Medium

Medium plays randomly about half its turns, so it will sometimes skip an obvious block. Keep a live threat on the board every move and it will eventually fail to defend one, letting you close the line and grow your Won count.

The history of Tic-Tac-Toe

Tic-tac-toe descends from ancient three-in-a-row games. Boards resembling it have been found scratched into Roman-era ruins, and a related game called terni lapilli was played in the Roman Empire with three pieces per player that were slid between positions. The modern paper-and-pencil version with a fixed 3x3 grid took its familiar English name in the nineteenth century.

The game is a favorite teaching example in mathematics and computer science because it is small enough to solve completely. With perfect play by both sides it always ends in a draw, which is why the Hard setting here, using the same exhaustive look-ahead approach, cannot be beaten. It was among the first games ever programmed on a computer, notably in the 1950s as a demonstration of machine play.

Frequently asked questions

Can I beat the Hard computer?

No. Hard evaluates every possible continuation before each move, so it plays perfectly and never leaves a winning opening. The best outcome against it is a draw, which happens when you correctly block every one of its two-in-a-row threats. Drop to Medium or Easy if you want to score actual wins.

Do I always play X?

Yes. In vs Computer mode you are always X and always take the first move; the computer is O and replies after a short pause. In 2 Players mode the first player is X and the second is O, alternating turns on the same device. There is no option to play as O against the computer.

Are my wins and losses saved?

The Won, Lost, and Draw counters are stored in your browser's local storage, so they persist when you return on the same device and browser. Only vs Computer games are counted; two-player results are never recorded. Clearing your browser data or opening the game in a different browser resets the totals to zero.

What counts as a win?

Completing any one of eight lines with three of your marks: the three rows, the three columns, or the two diagonals. The moment a line is finished the game ends and that line is highlighted in green. If all nine squares fill without any completed line, the result is a draw for both sides.

Why can't I tap a square sometimes?

Squares that already hold a mark are locked, and in vs Computer mode the whole board is locked while the status shows Computer thinking. That message appears for a fraction of a second after each of your moves while the computer chooses its O. Wait for Your turn (X) to return, then tap an empty square.

Explore More Games

View All →
A
Apex Fury
ArcadeMedium

Survive endless waves of neon enemies in this top-down arcade space shooter. Collect power-ups, dodge bullets, and chase your high score.

FEATURED
M
Mind Maze
PuzzleHard

Navigate through increasingly complex mazes that test your logic and spatial reasoning skills.

POPULAR
K
Kingdom Builder
StrategyMedium

Build your medieval kingdom from scratch. Manage resources, train armies, and conquer neighboring territories.

NEW
S
Shadow Strike
ActionHard

Two shadow ninjas clash in lethal combat. Master punches, kicks, and special attacks to defeat the AI opponent in best-of-3 rounds.

HARD