Gomoku
Five in a row · Medium computer
Your move: you play Black.
Player 2, choose your colour
Tap or click an intersection to place a stone there. With a keyboard, the arrow keys move between intersections and Enter or Space places a stone. U undoes, H gives a hint and N starts a new game.
Play Gomoku online, free
Gomoku, also called five in a row, is the strategy game where two players take turns placing stones on a 15×15 grid and the first to line up five of their own wins. This free Gomoku plays in your browser against the computer at four levels, from an Easy opponent that plays by feel to an Expert that searches for forced wins, or against a friend on the same phone, tablet or computer. You can take moves back, ask for a hint, choose between the freestyle and exactly-five rules, number the stones to review a game, and keep a record of your results. There is nothing to install and no account, and everything runs on your device.
How to play Gomoku
- Pick an opponent. Choose vs Computer and a level, or 2 Players to share the screen.
- Place a stone. Black moves first. Tap or click any empty intersection, where the lines cross, to put a stone there. Stones never move once placed.
- Make five in a row. Across, up and down or diagonally. The five winning stones are ringed and a line is drawn through them.
- Block your opponent. Every turn, check whether they threaten to make five or an open four, and block it if they do.
- Play again. Next game starts a new one, and by default Black passes to the other side so neither player keeps the first-move advantage.
On a phone the intersections are small, so Tap twice to place is on for touch screens: your first tap shows a see-through stone, and a second tap on the same point places it. Tap a different point to move it. You can turn this off in Options. With a keyboard, Tab to the board, move with the arrow keys and press Enter or Space to place a stone; U undoes, H asks for a hint and N starts a new game.
Gomoku rules: five or more, or exactly five?
There are two common rule sets, and you can pick either in Options:
- Freestyle (five or more). Any unbroken line of five or more stones wins. This is the rule most casual players know and the default here.
- Standard (exactly five). Only a line of exactly five wins. Six or more in a row, called an overline, does not count, and the game carries on.
Renju, the professional cousin of Gomoku, goes further and forbids Black from making a double three, a double four or an overline, to rein in the first player's advantage. Those restrictions aren't part of Gomoku and aren't used here.
The four computer levels
| Level | What to expect |
|---|---|
| Easy | Plays by feel. It builds its own lines and usually blocks a five, but often lets an open three through. |
| Medium | Blocks every four and open three and weighs attack against defence, but doesn't look ahead, so a run of forcing fours can catch it out. |
| Hard | Finds wins by continuous fours, for itself and for you, and checks your best reply before it moves. |
| Expert | Also reads threat sequences built from open threes and searches four moves deep. As Black it is very hard to stop. |
The computer judges every empty intersection by the shapes a stone there would make for each side, in all four directions: a five, an open four, a four, an open three, a closed three and smaller shapes. From Hard up it runs a threat-space search, the method behind the first proof that Black wins at Gomoku. It looks for a VCF (victory by continuous fours), a chain of fours that each leave you only one reply and end in an unstoppable five, and it looks for yours too, so it can break it before you start. Expert also searches for a VCT (victory by continuous threats), the same idea with open threes, and checks four moves ahead for quiet positions. The search runs in a background thread on your device, so the board stays smooth while the computer thinks.
Gomoku strategy
Know your threats
- Four: four of your stones in a line of five with one gap or open end left. It must be blocked at once.
- Open four: four in a row with both ends empty. It can be completed at either end, so it wins.
- Open three: three stones that can become an open four with one more move, such as three in a row with both ends free, or a split three like X·XX. It must be answered, or it turns into an open four.
Win with a double threat
Single threats get blocked. Games are won by making two at once. A four-three (a four and an open three made by the same stone) forces your opponent to block the four, and then you extend the three into an open four. A three-three (two open threes at once) wins the same way, because only one can be blocked. Look for an empty intersection where two of your lines cross, and build towards it.
A worked example
Say Black has stones on G8 and H8 in a row, and on J10 and J9 in a column. The point J8 lies on both lines. Black plays J8: the row G8-H8-J8 is now an open three, and so is the column J8-J9-J10. White can block only one of them; Black turns the other into an open four and wins two moves later. That intersection was worth spotting several moves earlier, by either side.
Defend early, attack with tempo
Block an open three as soon as it appears, ideally at the end where your blocking stone also helps your own lines. When you can, defend with a move that makes a four of your own: your opponent must answer it, and you gain a move. Play near the centre at the start, keep your stones connected, and don't drift to the edges, where lines have less room to grow.
Common mistakes
- Answering a four but missing the open three it was paired with.
- Blocking an open three with a stone that does nothing for you.
- Making lone threes that are easy to block instead of building a crossing point.
- Forgetting the diagonals, which are the hardest lines to see.
Black's advantage and the swap rule
Moving first is a big advantage. In 1994 the computer scientist L. Victor Allis used threat-space and proof-number search to prove that on an empty 15×15 board Black can always force a win in freestyle Gomoku, and standard Gomoku without opening rules. At the 1989 and 1991 world championships, played under the "pro" rule (Black's first stone in the centre, its second at least three intersections away), Black won 67 percent of games. Since 2009 the world championships have used the swap2 opening, in which one player sets up three stones and the other chooses a colour or adds two more stones and passes the choice back; Black's win rate under swap2 has been put at around 52 percent.
Here, Black alternates between you and the computer by default. For a fair game against a friend, turn on Swap opening in Options and choose 2 Players: one player places the first three stones (black, white, black), and the other then decides whether to keep White or take Black. The first player has every reason to make that position as even as possible.
A short history of Gomoku
The name comes from the Japanese gomokunarabe, roughly "five pieces in a line", and records trace the game back to the mid-1700s in Edo-period Japan, where it was played with Go stones on a Go board. The earliest surviving book on it dates from 1856. It reached Britain in the 19th century as "Go Bang", and it is played as wuziqi in China and omok in Korea. Renju, its tournament form with restrictions on Black, has its own world championships, and Gomoku world championships resumed in 2009 with the swap2 rule.
More games like Gomoku
If you enjoy lining up pieces, try Connect Four, where discs drop down a seven-column grid, or tic-tac-toe against its unbeatable level. For more board strategy, play Reversi, checkers or chess against the computer, close boxes in Dots and Boxes, or sow and capture seeds in Mancala.
Frequently Asked Questions
How do you play Gomoku?
Two players take turns placing one stone of their colour on an empty intersection of a 15×15 grid. Black always moves first. The first player to make an unbroken line of five stones across, down or diagonally wins. Stones are never moved or removed once placed, and if the board fills up with no five, the game is a draw.
Does six in a row count in Gomoku?
It depends on the rules. In freestyle Gomoku, five or more in a row wins, so six counts. In standard Gomoku only exactly five wins, and a line of six or more (an overline) does not count. You can choose either rule in Options; the computer plays both correctly.
Is Gomoku the same as Five in a Row?
Yes. Gomoku is the Japanese name (gomokunarabe, roughly "five pieces in a line"), and the same game is called five in a row, connect five, wuziqi in China and omok in Korea. In 19th-century Britain it was sold as Go Bang. Renju is a related tournament version with extra restrictions on Black.
Who has the advantage in Gomoku?
Black, the player who moves first. In 1994 L. Victor Allis proved that on an empty 15×15 board the first player can always force a win in freestyle Gomoku. That's why Black alternates between you and the computer by default here, and why tournaments use opening rules such as swap2.
What is the swap rule in Gomoku?
A way to cancel out Black's advantage. In the swap opening, one player places three stones (two black, one white) and the other then chooses which colour to play, so the first player has every reason to make the position even. Swap2 adds a further option: the second player may place two more stones and hand the choice back. Swap2 has been the world championship rule since 2009. To play the swap opening here, choose 2 Players and turn on Swap opening in Options: one player places the first three stones, and the other then keeps White or takes Black.
What is the best strategy for Gomoku?
Attack with threats your opponent must answer, and aim for a double threat. An open three (three in a row with both ends free) must be blocked, or it becomes an open four, which wins because it can be completed at either end. Moves that make two threats at once, such as a four plus an open three or two open threes, usually decide the game. In defence, block threes early, before they can combine.
What is an open four in Gomoku?
Four stones in a row with an empty intersection at both ends. It can be turned into five in two places, and your opponent can only block one, so an open four wins on the next move. A four with only one way to finish it is just a threat that forces a block.
Can you beat the computer at Gomoku?
Yes. Easy and Medium can be beaten with ordinary care. Hard looks for forced wins by continuous fours for both sides, so you need a double threat it can't see coming. Expert also reads threat sequences built from open threes and is very hard to stop when it plays Black. Playing Black yourself gives you the first-move advantage.
What is the difference between Gomoku and Renju?
Renju is a professional form of Gomoku on the same 15×15 board. Black is forbidden from making a double three, a double four or an overline, which limits the first player's advantage, and games start with a set opening procedure. White has no such restrictions. Gomoku itself has no forbidden moves.
Can Gomoku end in a draw?
Yes, if all 225 intersections are filled without a winning line, though between two players it's rare. Under the exactly-five rule draws become a little more likely, because six or more in a row doesn't win.
Are my games and record saved?
Yes, in this browser only. Your settings, the game in progress and your record against each level are kept in local storage on your device, so a reload or a visit to another page doesn't lose them. Nothing is uploaded, and Reset record in Options clears the statistics.
More games to play
Free, browser-based, and instant — no installs or accounts.