Skip to the game
Tic Tac Toe

Four in a Row

Drop red and yellow discs down a 7×6 grid and line up four before your opponent. Play Four in a Row against a three-level computer or a friend beside you.

Play Four in a Row

You
0
Draws
0
Computer
0

Loading the game…

Tap or click a column to drop a disc. With a keyboard, pick a column with the arrow keys and press Enter, or press1 to 7. U undoes and N starts a new game.

Game settings
Changing a setting starts a new game. Each opponent keeps its own score.
Opponent
Difficulty
You play

The board is 7 columns by 6 rows. Four discs in a line across, down, or diagonally wins.

How it works

How to play Four in a Row

Choose a column, let the disc fall to the lowest gap, and get four of your color in a line before the other player can block it.

  1. Step 01

    Pick a column

    Tap or click a column, or choose one with the arrow keys. Your disc falls to the lowest empty space in it.
  2. Step 02

    Line up four

    Get four of your discs in a row across, down, or diagonally. Red always moves first, then the players take turns.
  3. Step 03

    Block your opponent

    Watch for three in a line with an open space. If you don't fill it, your opponent will. A full board with no line is a draw.

Features

Three computer levels, two-player mode, and discs that fall

  • Easy, Medium, and a deep-searching Hard

    Easy plays loosely and misses some threats. Medium looks five moves ahead. Hard keeps searching deeper for almost half a second every move.

  • Red and Yellow on one screen

    Pass the phone or share the keyboard. The scoreboard switches to Red and Yellow.

  • Undo

    Take back a move. Against the computer, Undo takes back its reply and your move together.

  • Separate scores

    Each difficulty and the 2-player mode keep their own wins, losses, and draws, saved in your browser.

  • Mouse, touch, or keys

    Tap a column, click it, or pick one with the arrow keys and press Enter. Keys 1 to 7 drop straight into a column.

  • Discs that really drop

    Each disc falls through the board and bounces into place. If your device asks for less motion, discs appear at once.

Strategy

Four in a Row strategy: center, threats, and odd rows

Most games lost to Medium come down to one drop nobody checked. These five habits catch it, and then Hard is the real test.

  • Take the middle

    The middle column is part of more possible lines of four than any other. Discs there help you in every direction.

  • Make two threats at once

    Your opponent can block only one space per turn. Set up two open threes and one of them will connect.

  • Don't fill the space under a threat

    If your opponent needs a space one row up, dropping a disc just below it gives them that space next turn.

  • Count the rows

    Late in a game, threats on odd rows from the bottom tend to help Red, the first player, and threats on even rows tend to help Yellow.

  • Check the diagonals

    Diagonal lines are the easiest to miss, for you and your opponent. Look along both diagonals before every move.

About the game

Four in a Row: seven columns, six rows, and gravity

The rules, the computer levels, playing a friend, beginner strategy, the 1988 solution, and how the game relates to Connect 4.

Four in a Row is a two-player strategy game played on an upright grid: drop discs into the columns, and the first to line up four of your color wins. Because every disc falls to the lowest free space, each move decides which spaces open up above it, and much of the strategy comes from that. You can play the computer at three levels or a friend on the same screen, with no account to set up.

Four in a Row rules

The grid has 7 columns and 6 rows, 42 spaces in all, and 69 possible lines of four. Red always moves first, then the players take turns dropping one disc into any column that isn't full. The disc falls to the lowest empty space in that column, so you choose a column, never a space. Discs stay where they land, and a game of Four in a Row can't last more than 42 moves, 21 for each player.

The first player with four discs in a line across, down, or diagonally wins, and the winning discs are marked. If all 42 spaces fill with no line, the game is a draw.

Because you choose only a column, there are never more than seven possible moves on a turn, and fewer once columns fill. That small number is why the computer can look many drops ahead in a fraction of a second.

How the computer picks a column

Set Opponent to Computer, then choose how hard it plays under Difficulty. Medium is the starting level, and each of the three keeps its own scoreboard:

  • Easy spots a winning drop most of the time but blocks yours only a little more than half the time. Otherwise it picks a column at random, four times as likely to be the middle as an edge. Beginners can beat it.
  • Medium looks five moves ahead, counting both players' drops, and rarely falls for a simple trap. It picks among moves that score almost as well as its best, so the same opening won't always get the same reply.
  • Hard searches one move deeper at a time until its thinking time of about 0.45 seconds runs out, or until it finds a forced win or loss. It tries the middle columns first and remembers positions it has already scored, so it never works one out twice.

To score a position, Medium and Hard count every line of four that still holds only one color, and they rate your open threes as a little more dangerous than their own are useful. That slight lean toward defense is why both levels block early and rarely leave a three unanswered.

Under You play, choose Red to move first or Yellow to let the computer start. Undo takes back the computer's reply and your last move together, so it's your turn again; if the computer opened the game, its first disc stays.

Red against Yellow on one screen

Pick 2 players and the computer steps aside. You and a friend take turns dropping Red and Yellow discs on the same screen, and the Red and Yellow tally is kept apart from your games against the computer. Undo takes back a single disc in this mode, which helps when a finger slips, though it's worth agreeing on before a close game.

There's no online opponent to find; both of you play on this one device. Since Red can force a win with perfect play, take turns being Red.

Why the middle column and the odd rows matter

Every line of four across or diagonally spans four neighboring columns, and on a seven-column grid any four neighboring columns include the middle one. So 51 of the 69 possible lines run through the middle column, and only the 18 straight-up lines in the other columns miss it. A disc there is never wasted, which is why the computer tries the middle first and counts every middle disc in its favor.

After that, check every column on every turn for a drop that makes four, yours or your opponent's, before thinking about anything else.

Rows matter late in the game. Number them 1 to 6 from the bottom. Say Red has three in a row along row 3, the fourth space is empty, and the space under it on row 2 is empty too. Neither player wants to drop into that column: if Yellow fills row 2, Red drops onto row 3 and wins. As the other columns fill up, someone is eventually forced to play there, and with a threat on an odd row that player is usually Yellow. Even-row threats work the same way in Yellow's favor.

A solved game: why the first player has the edge

In October 1988, James Dow Allen and Victor Allis each showed, working independently, that the first player can always force a win with perfect play by starting in the middle column. Any other first move lets the second player hold at least a draw with best play.

Hard isn't a perfect player, because it stops searching after about 0.45 seconds, long before it could see to the end of a game from the opening. So the proof doesn't mean Red always beats it, but opening in the middle as Red is still the move the proof points to.

Starting a child on Four in a Row

Four in a Row works well as a first strategy game for a child: the rules take a minute to explain, and a line of four forming across, down, or diagonally is easy to see. Start them on Easy, which sets out to block a winning threat only about six times in ten, so they'll win often, then move up to Medium once they block threats without being told. In 2-player mode you can play them yourself and use Undo to show what a different drop would have done.

If they enjoy lining things up, classic Tic Tac Toe, Ultimate Tic Tac Toe, and Gomoku, five in a row on a bigger board, are good next games.

Dropping discs with a mouse, a finger, or the keys 1 to 7

Tap or click a column to drop a disc. With a mouse, the next disc hovers above the column you point at, so you can see where it will fall before you commit. The grid scales to the screen, from a phone to a wide monitor.

With a keyboard, pick a column with the arrow keys and press Enter, or press 1 to 7 to drop straight into a column. U undoes a move and N starts a new game, and each move is announced for screen readers. If your device asks for reduced motion, discs appear in place instead of falling.

Once the page has loaded, the whole game runs in your browser, Hard's half-second search included, so your drops aren't sent to a server for the computer to answer.

Four in a Row, Connect 4, and other names

The drop-disc game has gone by several names. An older one is The Captain's Mistress, and since 1974 it has been sold as Connect Four by Milton Bradley, now part of Hasbro. You'll also see it called 4 in a Row or Drop Four.

This version uses the same classic rules on a 7-by-6 grid, with its own design and code, and it isn't affiliated with Hasbro.

Scores and unfinished games in this browser

Your opponent, level, and disc color, a separate scoreboard for each opponent, and any game you haven't finished are saved in this browser's local storage, so a reload drops you back into the same position. They're kept there rather than on a server, and clearing the site's data removes them. Reset scores wipes the tally for the opponent you're facing now, and the privacy policy lists every item the site keeps.

FAQ

Four in a Row questions

Quick answers about Four in a Row: the rules, Connect 4, the computer, playing a friend, and saving.

How do you play Four in a Row?

Players take turns dropping a disc into one of seven columns, and it falls to the lowest empty space. The first player to get four discs in a line across, down, or diagonally wins. If the grid fills with no line, it's a draw.

Is this the same as Connect 4?

It uses the same rules as the classic 7-by-6 game sold as Connect 4. It's an original version with its own design and code, and it isn't affiliated with Hasbro.

Who goes first in Four in a Row?

Red always moves first. Against the computer, choose Red to start or Yellow to let the computer start.

Can the first player always win?

With perfect play, yes: the game was solved in 1988, and the first player wins by starting in the middle column. In real games both players make mistakes, so anyone can win.

Can I play Four in a Row against the computer?

Yes. Pick Easy, Medium, or Hard under Game settings. Easy is beatable by beginners, Medium looks five moves ahead, and Hard searches as deep as it can in about half a second per move.

Can I play Four in a Row with a friend?

Yes. Choose 2 players under Game settings and take turns dropping Red and Yellow discs on one screen, with a scoreboard of its own. You both need to be at the same device.

Can I take back a disc I dropped?

Yes, until the game ends. Against the computer, Undo takes back the computer's reply and your last move, so it's your turn again.

Can I play Four in a Row with just a keyboard?

Yes. The arrow keys, Home, and End pick a column, and Enter, Space, or the down arrow drops a disc. Keys 1 to 7 drop straight into a column, U undoes, and N starts a new game.

Will my Four in a Row scores still be here next time?

Yes, in this browser on this device. Each difficulty and the 2-player mode keep their own scores, and an unfinished game comes back when you reload. Clearing the site's data in your browser removes them.