How to play five in a row (gomoku)

Five in a row, also known as gomoku, is a classic strategy game for two players. The rules take a minute to learn; the tactics keep it interesting for years.

The rules

  • The game is played on a 15×15 board of empty cells.
  • One player plays X, the other O. X always moves first, then the players alternate.
  • On your turn, place one mark in any empty cell. Marks are never moved or removed.
  • The first player to make an unbroken line of five or more of their marks wins. Lines can be horizontal, vertical or diagonal.
  • If every cell is filled and nobody has five in a row, the game is a draw.
Five in a row: X wins.

This site uses freestyle rules, where a line of six or more also wins. Other variants exist: standard gomoku counts only exactly five, and renju adds restrictions for the first player to balance the game.

Beginner strategy

Five in a row is a game of threats: positions that force your opponent to answer. Whoever controls the threats controls the game.

1. Start near the centre

The centre gives your lines room to grow in every direction. Marks near the edge can only extend one way and are easy to block.

2. Know the open three

Three in a row with both ends empty is an open three. If it is not blocked, it becomes an open four next move, and an open four cannot be stopped. Block an open three right away, at one of its ends.

Open three: must be blocked at once.
Broken three: just as dangerous as a solid one.

3. Fours force a reply

Four marks with one open end is a four: your opponent must block the last cell immediately, or lose. An open four, with both ends free, cannot be blocked at all.

A four: O must block the highlighted cell.
Open four: two ways to win, only one can be blocked.

4. Win with double threats

The usual way to win is to create two threats with one move: two fours, or a four and an open three (a “four-three”). Your opponent can only block one of them.

5. Forced wins with continuous fours

Strong players look for a VCF (victory by continuous fours): a chain of fours where each one forces a block, ending in a double threat. Because every move forces the reply, the opponent never gets a free move to defend. The Hard computer level searches for exactly these sequences, so it is good practice.

6. Defend while you attack

The best defensive moves also build your own lines. Before every move, check two things: can you make a four or a winning double threat, and does your opponent have a three or four you must answer?

Glossary

Open three
Three marks in a line with both ends free; becomes an open four if ignored.
Four
Four marks that need one more cell to make five. Must be blocked at once.
Open four
A four that can be completed at either end. It cannot be stopped.
Four-three
One move that makes a four and an open three at the same time; usually wins.
VCF
Victory by continuous fours: a forced win made only of four-threats.
Overline
Six or more in a row. A win in freestyle gomoku, as played here.

Frequently asked questions

Is it free to play?

Yes. Playing against the computer and against other people is free, with no ads.

Do I need an account?

No account is needed to play against the computer. To play other people, keep a rating and appear on the leaderboard, sign in with Google.

How does the rating work?

Ratings use Glicko-2, the system lichess uses. Everyone starts at 1500. A question mark after a rating means it is still provisional and moves faster until you have played more rated games.

Is five in a row the same as gomoku?

Yes. Five in a row is the common English name for gomoku. This site plays freestyle gomoku: five or more marks in a row win.

Does the first player have an advantage?

Yes. With perfect play the first player wins freestyle gomoku on a 15×15 board, which Victor Allis proved in 1994. Between human players the advantage is much smaller, and good defence matters a lot.

Can I play on my phone?

Yes. The board fits phone screens, and you can add the site to your home screen to open it like an app.