Connect Four
Medium computer · Single games · game 1
You · red
0
Draws
0
Computer · yellow
0
Your move.
Press a column to drop a disc into it. Keys 1 to 7 drop into a column directly; with the board focused, the left and right arrow keys choose a column and Enter or the down arrow drops.
Play Connect Four online, free
Connect Four, often written Connect 4 and also known as four in a row, is the two-player strategy game played on an upright grid seven columns wide and six rows tall. You take turns dropping a disc into a column, it falls to the lowest free space, and the first player to line up four of their own discs across, up and down, or diagonally wins. Here you can play the computer at four levels, from an Easy opponent that mostly looks at its own move to an Expert that searches as deep as it can in about a second and a half, or play a friend on the same phone, tablet or computer. Discs fall into place, the winning four are highlighted, the first move alternates between games, and you can take moves back, ask for a hint and play best-of matches. It runs in your browser with nothing to install and no account, and your record is saved on your device.
How to play
- Pick an opponent. Choose vs Computer and a level, or 2 Players to share the screen. Changing either starts a new match.
- Drop a disc. Tap or click anywhere in a column. Your disc falls to the lowest empty space; a full column won't take another.
- Make four in a row. Horizontal, vertical and both diagonals all count. The winning discs are highlighted and a line is drawn through them.
- Watch for a full board. If all 42 spaces fill with no four in a row, the game is a draw.
- Play on. Next game (or a tap on the finished board) starts the next game, with the first move passing to the other side. Options sets who goes first and best-of-3, 5 or 7 matches, and shows your record.
You play red; the computer, or your friend, plays yellow. Undo takes back your last move (with the computer's reply), and Hint asks the engine for a strong column. With a keyboard, the keys 1 to 7 drop a disc straight into that column; or Tab to the board, choose a column with the arrow keys and press Enter. U undoes, H gives a hint and N starts the next game.
The four computer levels
| Level | What to expect |
|---|---|
| Easy | Looks only at its own move. It grabs a win it can see but often misses your threats. |
| Medium | Looks four moves ahead. It blocks your direct threats and sets simple traps of its own. |
| Hard | Looks eight moves ahead and rarely misses a tactic. Beating it takes a long-term plan. |
| Expert | Searches as deep as it can in about a second and a half, often more than a dozen moves, and opens in the centre. |
Medium, Hard and Expert use a minimax search with alpha-beta pruning, the classic method for two-player games: it tries every column, every reply and so on, skipping lines that can't change the result. It always takes a win it can see and blocks yours, and it treats two simultaneous threats as decisive. To judge positions it can't search to the end, it scores every possible line of four by how many discs each side has in it, and adds a bonus for each empty square that would complete a four, bigger when that square sits on a row that favours its owner. The search runs in a background thread on your device, so the board stays smooth while it thinks. Easy and Medium add some randomness, so no two games are quite the same.
Connect Four strategy
Start in the middle
The centre column belongs to more possible lines of four than any other, which is why the game's solution starts there. Of the 69 ways to make four in a row on this board, more pass through the middle columns than the edges, so discs there keep more options open for you and close more for your opponent.
A worked example: the bottom-row trap
Say you go first in column 4, your opponent drops on top of you, and you play column 3. You now threaten to make three in a row along the bottom with both ends open. Your opponent has to answer in column 2 or column 5 at once. Any other move lets you complete columns 2, 3 and 4 or 3, 4 and 5 along the bottom with an empty space at each end, and they can block only one of those two winning squares. The computer never falls for this from Medium up, but people often do.
Think about the square below
A winning square only matters once the space beneath it is filled. Never play directly under your opponent's winning square, because they will drop onto your disc and win. Do the opposite with your own: build threats higher up and leave your opponent the uncomfortable job of filling the column beneath them.
Use the odd and even rows
Count rows from the bottom. As a rule of thumb, the player who moved first wants threats on odd rows (1, 3, 5) and the second player wants them on even rows (2, 4, 6). Late in the game, when only a few columns still have room, the players take turns filling them, and whether a threat sits on an odd or an even row decides who runs out of safe moves first and has to play underneath the other's threat. One good odd threat for the first player is often enough to win the endgame without any further tactics.
Common mistakes
- Ignoring the bottom row early on, which allows the open-ended three above.
- Making a single obvious threat that your opponent blocks while improving their own position.
- Filling a column just below your opponent's winning square.
- Drifting to the outer columns, which take part in far fewer lines of four.
- Counting only your own chances. Before every move, check what your opponent's best reply would be.
Facts about Connect Four
Connect Four was created by Howard Wexler and first sold by Milton Bradley in February 1974. On a 7×6 board there are 69 different lines of four and 4,531,985,219,092 possible positions with anywhere from 0 to 42 discs. In October 1988 James Dow Allen and Victor Allis independently solved the game: the first player can force a win by starting in the centre column, starting in either column next to it allows the second player to force a draw, and starting in one of the four outer columns lets the second player force a win. Knowing that result is a long way from being able to play it, which is why the game still works between people, and why alternating the first move keeps things fair.
More games like Connect Four
If you like thinking a few moves ahead, try tic-tac-toe against its unbeatable level, Reversi, where every move flips your opponent's discs, checkers with compulsory jumps, or chess against the computer. All of them have a two-player mode for playing a friend on one device.
Frequently Asked Questions
How do you win Connect Four?
Line up four of your discs in a row, across, up and down, or diagonally, before your opponent does. In practice games are won with a double threat: two different squares that would each complete four. Your opponent can block only one, so you play the other.
Who goes first in Connect Four, and does it matter?
It matters a lot: with perfect play the first player can always win by starting in the centre column. That's why the first move alternates here by default, between you and the computer or between Red and Yellow. In Options you can make one side always start instead.
Can you beat the computer at Connect Four?
Yes on Easy and Medium with a little care, and on Hard with a real plan. Expert searches as deep as it can in about a second and a half and is very hard to beat, but it is not a perfect solver, so a well-prepared threat late in the game can still catch it. Going first helps.
What is the best first move in Connect Four?
The centre column. The game was solved in 1988: starting in the middle column lets the first player force a win, starting in either column next to it allows the second player to hold a draw, and starting in any of the four outer columns lets the second player force a win.
Is Connect Four a solved game?
Yes. James Dow Allen and Victor Allis independently solved it in October 1988, showing that the first player wins with perfect play by starting in the centre. Perfect play takes far more calculation than anyone can do at the table, so the game is still very much alive between people.
Do diagonal lines count in Connect Four?
Yes. Four in a row counts horizontally, vertically and along either diagonal. When a game ends, the winning discs are highlighted and a line is drawn through them.
Can Connect Four end in a draw?
Yes. If all 42 spaces fill up and nobody has four in a row, the game is a draw. Draws go into their own column on the scoreboard and count as games played in a best-of match.
What is the odd and even row rule?
Counting rows from the bottom, a winning square on an odd row (1st, 3rd or 5th) tends to favour the player who moved first, and one on an even row (2nd, 4th or 6th) the player who moved second. Near the end, columns fill in a fixed rhythm, and the parity decides who is forced to play underneath the other's winning square.
How do I play Connect Four with a friend?
Choose 2 Players and share the screen. Red and Yellow take turns, the status line says whose move it is, and the first move alternates between games so the advantage is shared. Pick a best-of-3, 5 or 7 match in Options for a proper contest.
Can I take back a move?
Yes. Undo takes back your last move, together with the computer's reply when you're playing the computer, and in two-player mode it takes back one move at a time. A finished game can't be undone; it has already gone into the score.
Are my wins saved?
Yes, on this device only. Your settings, the game in progress, the match score and your record against each level are kept in your browser's local storage. Nothing is uploaded, and Reset record in Options clears the statistics.
More games to play
Free, browser-based, and instant — no installs or accounts.