Gomoku: play five in a row free against the AI or a friend

Gomoku, also called five in a row, is a board game where two players take turns placing black and white stones, and the first to line up five wins. On this page you can play it online in your browser, free and with no account, against the AI on three levels or with a friend on the same device.

More games

On this page: Rules · Standard, Freestyle, Caro · Swap2 · Easy, Medium and Hard · Buttons and scores · Strategy · FAQ

How to play Gomoku: the rules

Gomoku in brief: five stones in an unbroken line win. Black moves first, nothing is captured, and on the default Standard rules exactly five wins while six or more does not. A full board is a draw.

Gomoku is a game for two players, Black and White, who place stones on the points where the lines of a grid cross. The international rules use a 15×15 board with 225 points, and the game above starts on that board. This page covers those rules, three rule sets, the Swap2 opening and play against the AI. It has no Renju forbidden moves and no play over the internet.

  1. Black places the first stone.
  2. The players take turns placing one stone on any empty point. A stone never moves once it is placed, and nothing is captured.
  3. Five of your stones in an unbroken line, across, down or diagonally, win the game. On the default Standard rules the line must be exactly five.
  4. If every point fills up and nobody has five in a row, the game is a draw.
15×15 Gomoku board where five black stones on a diagonal are crossed by a red line, with the text Black wins! and the score Black 1, Draws 0, White 0
Black won with five stones on a diagonal. The red line marks the winning row.

The board size button, which shows 15×15, switches to 9×9, 13×13 or 19×19. Changing the size starts a new game.

Gomoku rule sets: Standard, Freestyle and Caro

Gomoku rule sets differ mostly on what happens when a line grows past five stones. The game on this page lets you choose. Open the Rules menu, the button that shows Standard, and pick one; a new game starts with the new rule.

Rule setWhat wins on this pageWhere the rule comes from
Standard (default)Exactly five in a row. Six or more does not win, and the game goes on.The international Gomoku rules of the Renju International Federation (RIF).
FreestyleFive or more in a row.Freestyle gomoku, as described on Wikipedia.
CaroFive or more in a row, except exactly five with an opponent's stone at both ends. The edge of the board does not count as a block, and six or more always wins.Caro, which Wikipedia says is popular among Vietnamese players. Wikipedia also has six or more always winning.

Pick Standard for the international rules, Freestyle if any line of five or more should win, and Caro for the version Wikipedia says is popular among Vietnamese players.

Gomoku board with six black stones in a row and no red line, with the text White's turn and the rule line Exactly 5 in a row wins. 6 or more does not.
On Standard, six black stones in a row do not win, so it is White's turn.
Gomoku board with five black stones in a row and a white stone at each end, with the text White's turn and the rule line 5 or more in a row wins, except exactly 5 blocked at both ends.
On Caro, five in a row with a white stone at each end does not win.

When there is room on the screen, the line under the turn repeats the rule in play, for example "Exactly 5 in a row wins. 6 or more does not." Short phone screens hide that line. The AI plays by the same rule set: on Standard it does not treat a line that would grow to six as a winning line.

The Swap2 opening

Black moves first, and in Gomoku that is a big advantage. Wikipedia reports that Black won 67 percent of games at the 1989 and 1991 world championships, which used the Pro opening rule. When the championships resumed in 2009, they used the Swap2 opening, and Wikipedia puts the first player's win rate under Swap2 at around 52 percent.

  1. One player opens by placing three stones: black, white, black.
  2. The other player picks Play Black, Play White, or Place 2 more.
  3. Place 2 more means placing a white stone and then a black one, after which the player who opened picks the color.
  4. White places the next stone, and play goes on as normal.

Turn on Swap2 opening in the Rules menu. Against the AI, you open the first game, the AI opens the next, and so on. When you open, the AI on Medium or Hard picks Black or White. On Easy it picks at random among the three choices, so sometimes it places 2 more stones and you pick the color. When the AI opens, three buttons appear under the status bar. Undo is off during the opening.

Gomoku board with two black stones and one white stone in the middle, the text Pick your color, and three buttons: Play Black, Play White and Place 2 more
The AI placed the three opening stones. Now you pick a color, or place two more stones and let the AI pick.

Play Gomoku against the AI or a friend

With vs AI picked, you play the computer. You are Black in your first game, so you move first. After that the first move switches sides every game, including the new game that starts when you change the mode, level, board size or rules.

To choose your color, use the Black and White choice next to the levels, labeled Play as on wider screens. The choice waits for the next game, and the screen shows "from next game" until then. It is off when Swap2 is on.

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.

LevelHow the AI picks a pointIn AI-against-AI test games (15×15, Standard)
EasyA random empty point next to the stones already on the board. It does not look for wins or blocks.Lost all 200 games against Medium and all 20 against Hard.
MediumTakes a winning point if it has one and blocks any four of yours. Otherwise it picks one of its three best-scored points at random.Won all 200 games against Easy and lost all 20 against Hard.
HardThe same checks. If neither applies, it searches ahead for up to 0.7 seconds per move.Won all 20 games against Medium and all 20 against Easy.

Easy is the level to practice on, since it never aims to win or block. Hard won every test game against the other levels, so it is the strongest choice on this page. In the test games the first move switched sides each game. Hard's search has a time limit, so on a slower device it looks fewer moves ahead; our test games ran on a desktop processor, and we have not measured Hard against strong human players.

15×15 Gomoku board after a loss to the Hard AI, with five white stones on a diagonal crossed by a red line among 23 other stones, the text AI wins, and the score You 0, Draws 0, AI 1
A game against Hard where our test script played Black. The AI won with a diagonal five after 14 stones each.

Undo, New game, scores and controls

  • Undo takes back your last stone. Against the AI it also removes the AI's reply, so it is your turn again. In 2 Players it takes back one stone at a time. Undo is off once a game is over.
  • New game clears the board and starts the next game right away.
  • Pieces, in the Rules menu, switches between stones on the points and X and O marks in the squares. It only changes the look: X is Black and O is White. The international rules also allow crosses and circles.
  • The speaker button turns sound on or off, and the page remembers the setting.
  • On a keyboard, press Tab to reach the board, move with the arrow keys, and press Enter or Space to place a stone. Screen readers hear each point's row and column and whether it is empty or holds a black or white stone, and the AI's moves are read aloud.
  • On a touch screen, when the points are smaller than about 28 pixels, the first tap shows a faded stone and the words "Tap again to place". Tap the same point again to place it, or tap another point to move the faded stone.
Gomoku board drawn as squared paper with orange X marks and blue O marks in the middle, and the text Black's turn
The X and O piece style: same rules, with X for Black and O for White.

The score line shows wins for each side and the draws. It is kept in this browser on this device, with a separate score for each board size, each level and 2 Players; the rule set does not split it. The Scores button, with the bar chart icon, shows a tab for each board size.

There is no account. If your browser blocks site storage, the score is not kept, and a private window forgets it when you close it.

Gomoku strategy

Gomoku games are won with threats: lines that become five if the other player does not answer.

  • Deal with an open three early. An open three is three in a row with both ends empty. Left alone, it becomes an open four, which can be finished at either end, and one stone can block only one end. Wikipedia's example game makes the same point: block it at once or answer with a threat of your own.
  • A four with only one open end will not beat Medium or Hard, because both levels block it. You need two winning points at once: an open four, a four plus an open three, or two fours.
  • On Standard, count before you fill a gap. A stone that joins two short lines into six in a row does not win here.
  • On Caro, watch both ends of your line. Exactly five with an opponent's stone at each end does not count, so once a line is blocked at one end, keep the other end open.

Moving first helps. In 1,000 games between two Medium AIs on this page's code, with Standard rules on 15×15, Black won 49.5%, White won 36.5% and 14.0% were draws. With perfect play the first player wins on an empty 15×15 board with no opening rule (see "Has Gomoku been solved?" below), which is why tournaments use openings such as Swap2.

The game at the top of this page starts on Medium, 15×15 and Standard; switch to Easy if you want to learn first. For the 3×3 version, play Tic Tac Toe, and for nine boards in one, try Ultimate Tic Tac Toe.

Gomoku FAQ

What is Gomoku?

Gomoku is a board game for two players, Black and White, who take turns placing stones on a grid. The first to get five stones in an unbroken line across, down or diagonally wins. It is also called five in a row.

Is Gomoku 4 or 5 in a row?

Five. You need five stones of your color in an unbroken line. On the Standard rules used by default on this page, the line must be exactly five; Freestyle and Caro also let six or more win.

Does six in a row win in Gomoku?

It depends on the rules. Under the international rules, and on Standard on this page, six or more in a row does not win and the game goes on. On Freestyle and Caro, six or more in a row wins.

Who goes first in Gomoku?

Black always places the first stone. On this page you are Black in your first game against the AI, and after that the first move switches sides every game. You can pick Black or White for the next game with Play as. With Swap2 turned on, the opening decides who ends up with Black.

Can Gomoku end in a draw?

Yes. If every point on the board fills up and nobody has five in a row, the game is a draw. In 1,000 games between two Medium AIs on this page, with Standard rules on 15×15, 14.0% ended that way.

Has Gomoku been solved?

Partly. In 1994 L. Victor Allis proved that the first player can force a win on an empty 15×15 board when there is no opening rule. Wikipedia notes that opening rules such as Swap2, used in tournaments, have not been solved.

What is the difference between Go and Gomoku?

Both use black and white stones on the same kind of grid, but the goals differ. In Gomoku you win by lining up five stones. In Go the aim is to fence off more territory than your opponent, and stones can be captured. Stones are never captured or moved in this Gomoku game.

What does Gomoku mean?

The name comes from the Japanese gomokunarabe (五目並べ): go means five, moku is a counter word for pieces, and narabe means line-up. Wikipedia traces the game to Japan in the mid-1700s, and it is also called gobang, omok in Korea and wuziqi in China.

What size board is Gomoku played on?

Usually 15×15. The international rules use a 15×15 board, and Wikipedia notes that 19×19 was the standard size in the past. This page offers 9×9, 13×13, 15×15 and 19×19 and starts on 15×15.

What is Swap2 in Gomoku?

Swap2 is an opening rule meant to reduce Black's first-move advantage. One player places three stones, black, white and black. The other player then picks Black, picks White, or places two more stones and lets the first player pick. Wikipedia puts the first player's win rate under Swap2 at around 52 percent in tournament play.

Does this page use Renju rules?

No. Renju forbids some of Black's moves, such as making two open threes or two fours with one stone. This page forbids no moves. Its rule sets are Standard, Freestyle and Caro, and on Standard a six in a row does not win for either color.

Can I play Gomoku against the computer?

Yes. Pick vs AI and choose Easy, Medium or Hard. Easy places stones at random next to the stones already on the board and does not look for wins or blocks. Medium and Hard always take a winning point and block your fours, and Hard then searches ahead for up to 0.7 seconds per move.

Can two people play Gomoku on one device?

Yes. Pick 2 Players and take turns on the same phone, tablet or computer. There is no way to play someone on another device from this page.

Is Gomoku like tic tac toe?

Yes, it is the same idea on a bigger board. Tic tac toe needs three in a row on a 3×3 grid; Gomoku needs five in a row, usually on a 15×15 board. This page can also draw the pieces as X and O.

Does the game save my score?

Yes, in this browser on this device. There is one score for each board size, kept separately for each AI level and for 2 Players, and the scores stay after you close the page. If your browser blocks site storage, nothing is saved, and a private window forgets the scores when you close it.

Last checked on : in headless Chrome with a 761×1000 viewport (emulation, not a real phone) we played a 2 Players game to a win, set up a six in a row on Standard and a blocked five on Caro, played a Swap2 opening against the AI, and lost a game to Hard with a simple scripted player. The test games (200 Medium against Easy, 20 Hard against Medium, 20 Hard against Easy, 1,000 Medium against Medium) ran on this page's game code in Node.js 24 on an Intel Xeon E5-2696 v3.

Sources, read on November 16, 2026: Renju International Federation, "International Rules of Gomoku" (15×15 board, Black first, exactly five, six or more does not win, Swap2, crosses and circles, draw on a full board); Wikipedia, "Gomoku" (other names, meaning and origin, board sizes, Freestyle, Caro and Renju, championship win rates, Swap2 since 2009, Allis 1994, the open three in the example game); Wikipedia, "Go (game)" (territory and captures).

Changes: November 16, 2026, first version of this page.

Rate this game

Your rating