On this page: Rules · Easy, Medium and Hard · Buttons and scores · Strategy · FAQ
Tic Tac Toe 5x5 rules: get 4 in a row
Tic Tac Toe 5x5 is a game for two players, X and O, on a board of 25 squares. You win by getting 4 of your marks in a row.
- X and O take turns marking one empty square. X opens the first game.
- 4 marks in a row, across, down or diagonally, win the game.
- A line of 5 also wins. A move that joins two groups of marks can make 5 at once.
- If all 25 squares fill up and nobody has 4 in a row, the game is a draw.

4 in a row or 5 in a row?
This page asks for 4. Some pages ask for 5 in a row on a 5×5 board, and others add twists such as sliding a row; those are different games. The 5 in a row game on a much larger board is on the Tic Tac Toe 100x100 page. For the classic 3×3 game, go to the home page.
Easy, Medium or Hard: how the AI plays
With vs AI picked, you play the computer. You are X unless you pick O next to Play as; that switch waits for the next game. With 2 Players picked, two people share one phone, tablet or computer. There is no network play, so you can't play someone on another device.
The first move changes sides with every new game, including the new game you get when you switch mode or level.
| Level | How the AI picks a square | In our test games |
|---|---|---|
| Easy | A random empty square next to a mark already on the board. On an empty board it takes the center. | Lost 196 of 200 games against Medium and drew 3. |
| Medium | Takes a winning square at once, blocks a square where you would win, and otherwise picks at random from its 3 best-scored squares. | Won 196 of 200 against Easy. Did not win any of 20 against Hard: 11 losses, 9 draws. |
| Hard | The same win and block checks, then a search several moves ahead for up to 0.7 seconds per move. | Won 20 of 20 against Easy, won 11 and drew 9 of 20 against Medium, and drew all 10 against another Hard. |
Easy suits learning the rules. Medium and Hard are stronger: in our test games Hard won 11 and drew 9 of 20 against Medium. Hard stops searching when it finds a forced result or after about 0.7 seconds, whichever comes first. We ran the test games with this page's game code in Node.js, and the first move switched sides each game. Hard looks less far ahead on a slower device, so results may differ on a phone. Hard is not guaranteed to play perfectly, and we have not measured it against expert human players.

Tic Tac Toe 5x5 strategy
One winning threat on a 5×5 board is an open three: three marks in a row with an empty square at each end. Your opponent can block only one end, and you win with the other unless they can make 4 in a row first.

- Both possible fours on a 5-square line contain its three middle squares. One of your marks in any of those squares ends that line for your opponent, and an open three needs all three of them.
- The center square sits on 8 of the 28 possible lines of 4 on the board. The squares around it sit on 6 each, and a corner on 3. In our tests Hard opened in the center when it moved first, and took the center when we opened in the top-left corner.
- Block early. On a row, column or long diagonal, take one of the line's middle squares before your opponent makes an open three there.
When both sides move at random, going first gives an edge. In 100,000 random games with X moving first every time, X won 52.6%, O won 40.9% and 6.5% were draws. A game lasted 19.1 moves on average, with about 15.5 empty squares to choose from on each turn.
Can the game be solved?
Yes. Jos Uiterwijk's 2019 paper "Solving Strong and Weak 4-in-a-Row" used a computer search to show that a 5×5 board with 4 in a row is a draw with perfect play, and that 5×6 is the smallest board where the first player can force a win, which covers 6×6 too. The paper also solves a version where the second player may only block and can never win. There the first player wins even on 5×5, since the defender has no threats of its own to slow the attack. Wikipedia's article on m,n,k-games lists the same 5×5 draw. Try the next size up on Tic Tac Toe 6x6, or a smaller one on Tic Tac Toe 4x4.
Tic Tac Toe 5x5 FAQ
How do you play tic tac toe 5x5?
Two players, X and O, take turns marking an empty square on a 5×5 board. The first player to get 4 marks in a row, across, down or diagonally, wins. If all 25 squares fill up and nobody has 4 in a row, the game is a draw.
How many in a row do you need to win on a 5x5 board?
On this page you need 4 in a row. A line of 5 also wins. Some other versions ask for 5 in a row on a 5×5 board or add twists such as sliding a row; those are different games from this one.
How do you win at tic tac toe 5x5?
Build three marks in the middle three squares of a row, column or long diagonal while both end squares are empty. Your opponent can block only one end, and you finish four in a row with the other, unless they can make 4 in a row first. With perfect play neither side can force a win, so this works when your opponent leaves the line open.
Is 5x5 tic tac toe solved?
Yes. With 4 in a row, a 5×5 board is a draw when both players play perfectly. Jos Uiterwijk's 2019 paper "Solving Strong and Weak 4-in-a-Row" confirms this with a computer search, and Wikipedia's article on m,n,k-games lists the same result, written (5,5,4). On this page, Hard played itself 10 times and all 10 games ended in a draw with a full board.
Does the first player have an advantage on 5x5?
Not with perfect play. Wikipedia says no m,n,k-game gives the second player a forced win, and Uiterwijk's 2019 computer search shows this board is a draw, so the first player cannot force a win either. In 100,000 games of random moves on this page, X, moving first, won 52.6%, O won 40.9% and 6.5% were draws.
Can you always win 5x5 tic tac toe?
No. 5×5 with 4 in a row is a draw with perfect play, so no player can force a win, and on this page Hard played itself 10 times and all 10 games ended in a draw. You can still win when your opponent leaves a three open at both ends and cannot make 4 in a row first.
Can I play tic tac toe 5x5 against the computer?
Yes. Pick vs AI and choose Easy, Medium or Hard. Easy plays random squares next to marks already on the board. Medium and Hard take a winning square at once and block yours. Hard also searches ahead for up to 0.7 seconds per move.
Can you beat the Hard AI on 5x5?
We don't know whether a strong human can, because we have not tested Hard against expert players. In our test games Hard did not lose to Medium in 20 games, and a player who clicked random squares lost all 20 games against it.
Can two people play tic tac toe 5x5 on one device?
Yes. Pick 2 Players and pass the phone, tablet or computer between turns. There is no way to play someone on another device from this page.
How is 5x5 different from 4x4 and 6x6?
On this page, 4×4 needs a whole line of 4, while 5×5 and 6×6 need 4 in a row inside a longer line. With perfect play, 5×5 is a draw and 6×6 is a first-player win, according to Uiterwijk's 2019 computer search. See the 4×4 and 6×6 pages to try them.
Does the game save my score?
Yes, in this browser on this device. There is one score for each level and one for 2 Players, and they stay after you close the page. If your browser blocks site storage, nothing is saved.
Last checked on : we played one 2 Players game and one game against Hard in Chrome at 1280×800, and looked at the board at 390×844. The test games (200 Medium against Easy, 20 Hard against Easy, 20 Hard against Medium, 10 Hard against Hard, and random players) and the 100,000 random games ran on this page's game code in Node.js 24 on an Intel Xeon E5-2696 v3.
Sources, read on November 16, 2026: Jos W.H.M. Uiterwijk, "Solving Strong and Weak 4-in-a-Row", IEEE Conference on Games 2019 (5×5 is a draw, 5×6 and larger boards are first-player wins, the block-only version is a first-player win on 5×5); Wikipedia, "m,n,k-game" (the 5×5 draw and no forced second-player win).