Gomoku (Five in a Row)

Play Gomoku (five in a row) free in your browser: 3 AI levels, 2-player mode, 15×15, 19×19 or a large 30×30 board, caro rules, undo, hints and autosave.

Your turnThinking…
Moves: 0Freestyle (5+)
Score
0You
0Draws
0Computer

What Is Gomoku (Five in a Row)?

Gomoku, also called five in a row, gobang or connect five, is a two-player strategy game played on a grid. Players take turns placing a mark – X and O, or black and white stones – on an empty cell, and the first to make an unbroken line of five wins. The rules take ten seconds to learn, yet the game hides deep tactics: open threes, fours, double threats and long forcing sequences. Gomoku is played around the world under different names: in Japan it is gomoku narabe, in Korea omok, in Vietnam cờ caro, and its professional variant with opening restrictions is called renju. This free online version lets you play against a computer opponent with three difficulty levels or against a friend on the same device, on a classic 15×15 board, a 19×19 Go-sized board or a large 30×30 board that feels like playing caro on squared paper.

Gomoku Rules and Variants Supported

  • Freestyle: a line of five or more of your marks wins. This is the most common casual rule and the default here.
  • Exactly five: only a line of exactly five wins; an overline of six or more does not count. This is the rule of standard gomoku tournaments.
  • Caro (blocked both ends): popular in Vietnam – a line of five or more wins only if it is not blocked by your opponent's marks at both ends. The board edge does not count as a block.
  • First move: X (Black) always moves first. Against the computer you can choose whether you or the computer starts.
  • Draw: if the whole board fills up without a valid five, the game is a draw – rare on a 15×15 board and almost impossible on 30×30.

Features

  • Three AI levels: Easy for beginners, Medium that sees a few moves ahead, and Hard that searches deeply and spots forced wins by continuous fours.
  • Non-blocking AI: the computer thinks in a Web Worker, so the page never freezes, even on phones.
  • Local 2-player mode for playing with a friend on one phone, tablet or computer.
  • Board sizes: 15×15 (standard gomoku), 19×19 (Go board) and 30×30 for a large caro feel.
  • Three rule sets: freestyle, exactly five and Vietnamese caro (blocked both ends does not win).
  • Two piece styles: classic X/O on squared paper or black and white stones on a wooden board.
  • Last move and winning line highlighted so you never miss what just happened.
  • Undo, hints and move counter; the hint button asks the Hard engine for the best move.
  • Score tally across games, separately for vs Computer and 2-player mode.
  • Autosave: reload the page or come back tomorrow and your game is still there.
  • Mobile friendly: the board fits a 390 px phone, with zoom buttons, scrolling for large boards and an optional tap-twice-to-confirm mode against misclicks.
  • Dark mode, sound effects and no registration or download.

How to Play Gomoku Online Here

  1. Choose vs Computer or 2 Players in Game mode.
  2. Against the computer, pick a difficulty and decide who moves first.
  3. Select a board size (15×15, 19×19 or 30×30) and a rule: Freestyle, Exactly five or Caro.
  4. Click or tap an empty cell to place your mark. On small screens, turn on "Tap twice to confirm" to avoid accidental moves.
  5. Build lines of your own while blocking your opponent's open threes and fours.
  6. The first player to make a valid five in a row wins; the winning line is highlighted.
  7. Use Undo to take back a move, Hint to see a suggestion, and New Game to start again with new settings.
Gomoku (Five in a Row) — Play Gomoku (five in a row) free in your browser: 3 AI levels, 2-player mode, 15×15, 19×19 or a large 30×30 board, caro
Gomoku (Five in a Row)

Gomoku Strategy Tips

  • Start in the centre. Central moves have room to grow in all eight directions; edge moves are easy to block.
  • Know your threats. An open three (_XXX_) must be answered at once, or it becomes an open four that cannot be stopped.
  • Always block a four. A four with one open end wins next move unless you play on that open end.
  • Create double threats. A move that makes two open threes (3-3) or a four plus an open three (4-3) usually wins, because your opponent can only block one.
  • Play connected and diagonal shapes. Stones placed diagonally or one gap apart build several potential lines at once.
  • Defend with attack. The best block also extends your own lines, so you gain tempo while defending.
  • Count tempo. If you have a four available, check whether a chain of fours (VCF) leads to a win before defending.
  • Under the caro rule, a five pinned between two enemy marks does not count – so aim for lines with at least one open end, and sandwiching your opponent's lines is a real defence.
  • As the second player, stay close to your opponent's stones and block early; the first player has a natural advantage.
  • Practise against Easy and Medium, use Hint to learn typical shapes, then challenge Hard.

History of Gomoku

Five-in-a-row games are believed to have been played on Go boards in East Asia for centuries. The name gomoku comes from the Japanese gomoku narabe, "five pieces in a row", and the game became widely popular in Japan in the Meiji era, where it was played with Go stones on the 19×19 board. In 1899 the variant renju introduced restrictions for Black (no double threes, double fours or overlines) to reduce the first-player advantage, and international renju tournaments are still held today. In 1994 computer scientists proved that on a 15×15 board, freestyle gomoku is a win for the first player with perfect play. In Vietnam the game spread as cờ caro, played with X and O on squared notebook paper in school, often with the rule that a five blocked at both ends does not count.

Why Play Gomoku?

  • Trains pattern recognition, planning and counting several moves ahead.
  • Each game lasts only a few minutes – perfect for a short break.
  • Easy to teach children and friends, yet deep enough for serious players.
  • Playing against the computer improves your tactics faster than random play.
  • Works offline once the page has loaded, with no account and no download.

Gomoku FAQ

Yes. It is completely free, needs no registration and no download. The game and the computer opponent run inside your browser.

They are the same family of games: get five in a row on a grid. Gomoku is the Japanese name, caro (cờ caro) is the Vietnamese version usually played with X and O and often with the blocked-both-ends rule, and renju is the professional variant with restrictions on the first player.

Easy picks reasonable moves with a lot of randomness but always takes a win and blocks a four. Medium searches about four moves ahead. Hard searches six to nine moves deep with alpha-beta pruning, looks for forced wins by continuous fours and checks that its move does not allow one. Hard answers in about one to two seconds.

Under this rule a line of five (or more) only wins if at least one end is not occupied by an opponent's mark. For example O X X X X X O does not win, while O X X X X X _ does. The edge of the board is not treated as a block.

Only a line of exactly five marks wins. If you connect six or more (an overline), it does not count and the game continues. This is the rule used in standard gomoku.

The first player (X or Black). On 15×15 freestyle gomoku the first player can force a win with perfect play, which is why renju adds restrictions. Against the computer you can choose to move first to make it easier, or let the computer start for a challenge.

Yes. Choose 2 Players in Game mode and take turns on the same phone, tablet or computer. The score is counted separately for X and O.

Yes. Choose 30×30 (large) to get a big caro-style board. On phones you can scroll the board and use the zoom buttons in its corner.

Yes. Every move is saved in your browser together with the settings and the score. When you return, the game resumes where you left off.

Turn on "Tap twice to confirm a move". The first tap shows a preview of your mark, the second tap on the same cell places it. You can also zoom the board in.

Yes. Undo takes back your last move (and the computer's reply in vs Computer mode). It also works after a game has ended, so you can try a different defence.

This page offers play against the computer and local 2-player mode on one device. There is no online matchmaking, so you can start instantly with no account and no waiting.