Four in a Row

Play Four in a Row online free: drop discs and line up four before your rival. 4 AI levels up to Expert, 2-player mode, undo, hints and bigger boards.

Your turn – drop a red disc
Click or tap a column. Keyboard: keys 1–9, or ← → then Enter; U to undo.
Score
0You
0Draws
0Computer
Moves: –

What Is Four in a Row?

Four in a Row is a two-player strategy game played on an upright grid of seven columns and six rows. Players take turns dropping a coloured disc into a column; the disc falls to the lowest empty space. The first player to line up four of their own discs horizontally, vertically or diagonally wins, and if all 42 spaces fill up with no line of four the game is a draw. The game is widely known as connect four, and it looks simple enough for a six-year-old – yet it hides deep tactics built on gravity, forced replies and the parity of rows. This free online version lets you play against a computer opponent with four difficulty levels, or against a friend on the same phone, tablet or computer, with no download and no sign-up.

Features

  • Four AI levels: Easy makes human-like mistakes, Medium plays sensibly, Hard looks about ten moves ahead and Expert searches as deep as it can for about 1.5 seconds per move
  • Strong, original engine: negamax search with alpha-beta pruning, a transposition table, threat-first move ordering and odd/even threat evaluation, running in a Web Worker so the page never freezes
  • 2-player mode: Red and Yellow take turns on one device – perfect for a quick match with a friend or a child
  • Choose who starts: you, the computer, or alternate automatically from game to game
  • Three board sizes: the classic 7×6 plus larger 8×7 and 9×7 grids for longer, more open games
  • Smooth play: drop animation, column hover preview, last-move marker and highlighted winning four
  • Undo and Hint: take back a move (against the computer it takes back your move and its reply) or ask the engine for a suggestion
  • Score tally and autosave: wins, losses and draws are kept for each mode, and an unfinished game is restored when you return
  • Keyboard and touch: number keys 1–9 drop straight into a column, arrows plus Enter move a cursor, and big tap targets work on phones down to 360px wide

How to Play

  1. Pick a mode: Vs Computer (you are Red) or 2 Players (Red and Yellow share the device).
  2. Choose the difficulty, who makes the first move and the board size. Changing the board size or mode starts a new game.
  3. On your turn, click or tap any column – or press its number key. Your disc drops to the lowest free space in that column.
  4. Take turns. Try to get four of your discs in a straight line – across, up and down, or on either diagonal – while blocking every line your opponent builds.
  5. When someone connects four, the winning line glows and the score is updated. If the board fills with no winner, the game is drawn.
  6. Press New Game to play again, Undo to take a move back, or Hint if you are stuck.

Strategy Tips

  • Own the centre column. A disc in the middle column can belong to more potential lines of four than any other square, which is why the strongest first move on the standard board is in the centre.
  • Look for double threats. A single threat is easy to block. Two threats at once – or a threat stacked directly on top of another – usually win the game outright.
  • Never play under your opponent's threat. If your rival needs one particular square to win, avoid filling the square directly beneath it, because that lets them drop onto the winning spot.
  • Understand odd and even rows. Counting rows from the bottom, the player who moves first benefits most from threats on odd rows (1, 3, 5) and the second player from threats on even rows (2, 4, 6). Late in the game, when columns fill up, these threats decide who is forced to give way.
  • Play for zugzwang. As columns fill, every move may become a bad one. Keep safe 'waiting' moves in reserve so your opponent runs out of harmless options first.
  • Block early, not late. Three in a row with both ends open on the bottom row cannot be stopped – block a two-in-a-row on the bottom row before it becomes a double threat.
  • Use Hint and Undo to learn. Try a move, see how Expert punishes it, take it back and look for the stronger idea.
Four in a Row — Play Four in a Row online free: drop discs and line up four before your rival. 4 AI levels up to Expert, 2-player mode,
Four in a Row

History of the Game

Games of alignment on a grid are ancient – tic-tac-toe and gomoku are close relatives – but adding gravity turned the idea into something new: you can only claim the lowest free square of a column. Vertical drop-disc games became popular as boxed toys in the 1970s and have been played in classrooms, family rooms and pubs ever since, under many names in different languages. The standard 7×6 game also has a special place in computer science: in 1988 James D. Allen and, independently, Victor Allis proved that the first player can force a win with perfect play by starting in the centre column. Later solvers confirmed the result and computed the outcome of every position, and the game remains a favourite exercise for learning search algorithms such as minimax and alpha-beta pruning – the same family of techniques used by the computer opponent on this page.

Why Play Four in a Row?

  • Builds planning and pattern recognition: you must think several moves ahead and spot threats before they appear
  • Games last only a few minutes, so it is ideal for short breaks
  • Simple enough for children, deep enough for adults who want to study odd/even strategy
  • Works offline after loading, with no account, no ads inside the game and no data leaving your device

Frequently Asked Questions

Yes. It is completely free with no download, no registration and no time limits. Everything, including the computer opponent, runs inside your browser, so once the page has loaded you can keep playing even with a weak or no connection.

It follows the same classic rules people usually call connect four: a vertical 7×6 grid, discs fall to the bottom, and four in a line horizontally, vertically or diagonally wins. This is an independent, original implementation and is not affiliated with any toy brand.

Easy looks only two moves ahead and sometimes forgets to block, so beginners can win. Medium searches four moves with a little randomness. Hard looks about ten moves ahead. Expert uses iterative deepening for about 1.5 seconds per move and usually reaches 12–16 moves deep, finding forced wins and losses exactly in the endgame – it is a serious opponent.

On the standard 7×6 board, yes – with perfect play the first player wins by starting in the centre column, as proved in 1988. In practice the winning line is extremely long and precise, so human games are wide open. If the first player starts anywhere else, the second player can force at least a draw.

Set Mode to 2 Players. Red and Yellow then take turns on the same screen. The 'Who starts' option lets Red or Yellow begin, or alternates the first move every game, and the score keeps a separate tally for two-player games.

It takes back the computer's reply and your last move together, so it is your turn again in the earlier position. In 2-player mode Undo takes back one move at a time. You can even undo the winning move after a game ends to explore other lines.

Yes. Press 1–7 (or up to 9 on wider boards) to drop a disc in that column. Click the board or tab to it, then use the left and right arrows to move the preview and Enter, Space or the down arrow to drop. Press U or Backspace to undo.

Bigger boards give more room for long-term planning and make games less 'solved'. The engine still works on them, though it searches slightly less deeply because there are more possible moves.

Your current game, settings and score are stored in your browser's local storage. If you close the tab mid-game, the board is restored when you come back. Nothing is uploaded to a server.

A threat is an empty square that would complete four for one player. Counting rows from the bottom, threats on odd rows favour the first player and threats on even rows favour the second player, because when the board fills up the move order forces the opponent to play beneath them. Strong players plan their threats around this rule.

Usually because it has found a tactical reason: a forced block, a move that avoids handing you a square, or a waiting move in a zugzwang ending. On Easy and Medium it also adds a little randomness so games are not identical.