Home › Fun & Games › Tic Tac Toe

Tic Tac Toe

Get three in a row before your opponent does. Play against the computer on Easy, Medium or Unbeatable, or pass the device to a friend for a 2-player game.

Last updated:

You (X)0
Draws0
Computer (O)0

Your move

Scores are kept separately for each difficulty and for 2-player games, and saved on this device. Press N for a new game.

Advertisement
Advertisement

How to use the Tic Tac Toe

  1. Choose a mode: vs Computer or 2 players.
  2. Pick a difficulty (Easy, Medium or Unbeatable) and who makes the first move.
  3. Tap a square to place your X. The computer replies with O, or your friend takes the next turn.
  4. Get three in a row horizontally, vertically or diagonally to win. A full board with no line is a draw.
  5. Press Play again or N for the next game. The scoreboard keeps track of wins and draws.

How the unbeatable AI works

The computer uses minimax, a classic game-tree search. For every empty square it imagines placing its O there, then assumes you reply with your best move, then it replies with its best move, and so on until each line of play ends. A finished game is scored +10 for a computer win, −10 for a loss and 0 for a draw, adjusted by the number of moves so that faster wins and slower losses score better. The computer then chooses a move with the highest guaranteed score. Alpha-beta pruning skips branches that cannot change the decision, so the search takes only a few milliseconds.

Because tic tac toe is small (only 5,478 legal positions), minimax can search the whole game. When several moves are equally good, the computer picks one at random, so games do not always look the same even though it never loses.

Tic tac toe by the numbers

FactValue
Possible games (move sequences)255,168
Games won by the first player131,184
Games won by the second player77,904
Games ending in a draw46,080
Legal board positions (including the empty board)5,478
Different finished positions958
Result with perfect playDraw

Strategy tips

  • Win if you can, block if you must. Always check for a square that completes your line, then for one that stops your opponent's.
  • Create a fork. A fork is a move that threatens two lines at once; your opponent can only block one.
  • Open in a corner. If your opponent answers with anything other than the centre, you can force a win.
  • Answer a corner with the centre. As the second player, taking the centre after a corner opening is the only reply that avoids losing.
  • Watch the opposite-corners trap. If you hold the centre and your opponent holds two opposite corners, play an edge, not a corner, to avoid a fork.

Frequently asked questions

Can you beat the Unbeatable computer?

No. On Unbeatable the computer uses the minimax algorithm to search every possible continuation and always picks a best move, so the best you can do is a draw. Tic tac toe is a solved game: with perfect play from both sides it always ends in a draw.

What is the difference between Easy, Medium and Unbeatable?

Easy picks a random empty square every turn. Medium plays the perfect move about 60% of the time and a random move otherwise, so it makes occasional mistakes you can exploit. Unbeatable always plays perfectly.

How do I play against a friend?

Choose 2 players. Player X and player O take turns on the same screen, and the scoreboard counts wins for each player separately from your games against the computer.

Who goes first?

By default the first move alternates between X and O every game, which keeps things fair. You can also set X or O to always start under First move.

What is the best first move in tic tac toe?

Against a perfect opponent every first move leads to a draw, but a corner gives the opponent the most chances to go wrong: the only reply that does not lose is the centre. The centre is also a strong, safe opening.

How many possible tic tac toe games are there?

There are 255,168 different possible games if you count every sequence of moves until someone wins or the board is full. The first player wins 131,184 of them, the second player 77,904, and 46,080 end in a draw.

Are all the tools on FreeToolCabin tested for quality and accuracy?

Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

Related tools

Snake GamePlay classic Snake online with speeds, wall modes and high scores.MinesweeperPlay classic Minesweeper: 3 difficulties, flags, timer and a safe first click.2048 GamePlay 2048 online with swipe controls, undo and best score.Block Puzzle GameClassic falling blocks puzzle game with levels and high score.Play Chess vs ComputerPlay chess online against the computer at 8 difficulty levels.Connect FourPlay Connect 4 online against the computer or a friend.HangmanClassic friendly hangman word game with categories, hints and difficulty levels.Memory Card GameFlip cards and match emoji pairs on 4×3 to 6×6 grids, with moves, timer and best scores.SolitairePlay classic Klondike Solitaire with Draw 1 or Draw 3 and undo.Spider SolitairePlay Spider Solitaire online with 1, 2 or 4 suits, hints, unlimited undo and a timer.Sudoku OnlinePlay free Sudoku with 4 difficulty levels, notes, hints and a timer.Word Guess GameGuess the hidden five-letter word in six tries. Unlimited games, stats and hard mode.Flappy GameTap to flap a round chick through bamboo gaps and beat your high score.Dino Runner GameJump cacti and duck buzzing beetles in an original endless desert runner.Typing GameType the falling words before they land; level up and track your WPM and accuracy.Math Quiz GameTimed mental math rounds with four operations, five levels, streaks and high scores.Flag QuizGuess the flags of all 196 countries in four modes, from multiple choice to timed.Map QuizFind countries on a clickable world map or name the highlighted one, by continent.Periodic Table QuizLearn all 118 elements: quiz symbols, names and atomic numbers or click them on the table.Spelling Bee GameMake words from 7 honeycomb letters, always using the center letter. New daily puzzle.Jigsaw PuzzleTurn a sample picture or your own photo into a 12 to 150 piece jigsaw puzzle and solve it.Sliding PuzzlePlay the 15 puzzle and 3×3 to 6×6 sliding tile puzzles with numbers or your own photo.Mahjong SolitaireMatch pairs of free tiles to clear the Turtle and two smaller layouts, with hints, shuffle and undo.Scrabble Word FinderFind the highest-scoring words from your rack, with blank tiles, patterns and bingo bonus.Wordle SolverEnter your guesses and colours to see every possible answer and the best next guess.Crossword SolverFind words that fit a crossword pattern like c?t from the length and the letters you know.Word Search GeneratorMake a word search puzzle from your words, play it online or print it with an answer key.Pong GamePlay classic Pong online against the computer on 3 levels or with a friend, first to 11.Breakout GameClassic brick breaker game with levels, power-ups and lives. Play with mouse, touch or keyboard.Whack-a-MoleWhack the moles before they hide in 30 or 60 second rounds. Speed increases, best score saved.Simon Says GameRepeat the growing color and sound sequence. Classic memory game with strict mode and high score.CheckersPlay checkers online against the computer or a friend, with kings, undo and hints.ReversiPlay Reversi (Othello rules) online vs a 3-level computer or a friend, with move hints.GomokuGet five in a row on a 15×15 board against a smart computer or a friend.Battleship GamePlace your fleet and sink the computer's ships in this classic naval guessing game.FreeCellPlay FreeCell solitaire online with the classic numbered deals, undo, hints and auto-move.Mastermind GameCrack the secret 4-color code in 10 tries using black and white feedback pegs.Tower of HanoiPlay the Tower of Hanoi puzzle with 3 to 8 disks, or watch it solve itself in the fewest moves.Trivia Quiz300+ general knowledge trivia questions in 10 categories. 10-question rounds with a timer and score.Random Riddle Generator150+ riddles with hidden answers in easy, hard and kids levels. Guess, get a hint or reveal.Nonogram PuzzlePlay unlimited nonogram (picross) puzzles from 5×5 to 15×15, each with one unique solution.Crossword Puzzle MakerTurn a list of words and clues into a crossword you can play online, share or print.Pyramid SolitairePlay Pyramid Solitaire online: pair cards that add up to 13 and clear the pyramid.Yacht Dice GamePlay the classic 5-dice scoring game solo for a high score or against a friend.MancalaPlay Mancala (Kalah rules) online against a smart computer or a friend on one screen.Lights Out GameTurn off every light in the classic 5x5 puzzle, with solvable random boards and a solver.BackgammonPlay backgammon online vs the computer or a friend, with doubling cube, undo and match scoring.Bubble Shooter GameAim, bounce and match 3 or more colored bubbles to pop them before the ceiling comes down.World Capitals QuizGuess the capital city of every country, by region, with multiple choice or typed answers.Categories Game GeneratorRandom letter and 12 categories from a 700+ pool, with round timer, printable sheets and scores.Chinese CheckersPlay Chinese checkers on a star board for 2, 3, 4 or 6 players, against friends or the computer.3x3 Cube SolverPaint your scrambled 3x3 cube and get a short step-by-step solution with a 3D animation.Dominoes GamePlay draw or block dominoes with a double-six set against 1 to 3 computer players.Emoji QuizGuess the word, phrase, animal, food or movie from emoji clues. 370+ puzzles with hints.Funny Fill-in-the-Blank Story GeneratorWord game: fill in nouns, verbs and adjectives without seeing the story, then reveal it.Golf SolitairePlay Golf Solitaire online: clear 7 columns by playing cards one rank up or down. 9-hole scoring.Guess the Number GameGuess the secret number with higher/lower or warm/cold hints, or let the computer guess yours.Hearts Card GamePlay Hearts online against 3 computer players: pass cards, dodge the Queen of Spades, shoot the moon.Kakuro PuzzlePlay generated cross-sum kakuro puzzles in several sizes with pencil marks and a combination helper.Killer SudokuPlay generated killer sudoku puzzles with cage sums, pencil marks, a cage combo helper and hints.Ludo GamePlay Ludo online with 2-4 players or against the computer: roll, capture and race home.Match 3 GameSwap gems to match 3 or more, trigger cascades and special gems, and beat each level's target.Snakes and LaddersPlay the classic board game online with 2-4 players or against the computer.Space Shooter GameRetro arcade space shooter: blast alien waves and meteors, grab power-ups and beat your high score.Spades Card GamePlay Spades online with a computer partner: bid tricks or nil, trump with spades, avoid bags.Stack Tower GameTap to drop sliding blocks and build the tallest tower. Perfect drops earn bonus points.US States QuizFind the 50 states on a clickable US map, type them all from memory, or match state capitals.Virtual Bubble WrapPop endless bubble wrap with click, touch or drag. Satisfying pop sounds and a pop-it fidget mode.
See all 141 Online Games →