Free online Connect 4
Connect 4 is the vertical-grid game where you drop discs and try to line up four of your colour before your opponent does. Gravity is what makes it more than tic-tac-toe on a bigger board: you never pick a square, only a column, so every move trades what you build now against what you hand your rival one row higher. Play free against the computer or a friend on the same device, and read on for how to beat the computer, why the maths favours whoever starts, and which threats actually win games.
History
The game went on sale in 1974 from Milton Bradley as Connect Four, with Howard Wexler and Ned Strongin credited as its creators. The gravity-fed vertical grid is what separates it from older line-up games. In Brazil it is known as Lig 4 and in the Spanish-speaking world as Conecta 4.
In 1988 it became one of the first well-known games to be completely solved, with James Dow Allen and Victor Allis reaching the result independently.
How to play
Click or tap any square in a column and the disc falls to the lowest free spot in that column. You play red and always move first; the computer answers in green after a short pause. Four in a row, horizontally, vertically or diagonally, wins. If all 42 squares fill up with no four in a row, the game is drawn.
The 2-player and vs-CPU buttons switch modes, and switching resets the game in progress. There is no scoreboard and no saved record: every game stands alone, and the new-game button restarts at any moment.
Rules
- A grid of 7 columns by 6 rows: 42 squares, 21 discs per player.
- Red always moves first. In vs-CPU mode the computer plays green.
- Clicking any square of a column counts as a move in that column. A full column accepts no more discs.
- Four in a row wins: horizontal, vertical or either diagonal.
- If the top row fills up with no winner, the game is a draw.
- While the computer is thinking the board is locked, so a double click cannot slip in an extra move.
- There is no undo, no scoreboard and no saved record.
Strategies
- Open in the centre column. The two middle cells of that column take part in 13 possible lines; a corner cell takes part in only 3.
- Build three with both ends open and playable. A single open end can be blocked; two cannot.
- Cut off potential double threats early. Three with one open end is manageable; two crossing pairs are not.
- Look at the square above your disc. Never drop underneath a square where your opponent completes four.
- Aim for the right parity. Counting rows from the bottom, red wants threats on odd rows and green on even rows.
How the computer decides
The computer follows three rules, always in this order, and nothing else.
There is no randomness: if you repeat the same moves it replies identically, and when two columns tie for a win or a block it takes the leftmost. The limit of this logic is that it only sees one move ahead. It does not notice double threats, it does not check whether its own disc hands you the square above, and when nothing is urgent it simply stacks up the centre until the column is full.
- 1. Win. If some column lets it complete four, it plays there.
- 2. Block. If you could complete four next move in some column, it takes that column.
- 3. Prefer the centre. With nothing urgent it picks the free column closest to the middle, in the order 4, 3, 5, 2, 6, 1, 7 counting from the left.
The trap that beats it: the double threat
A double threat appears when one disc creates two different squares that each complete four. The computer can block only one per turn, and you play the other. The shortest example against this opponent uses just the bottom row (columns numbered 1 to 7 from the left):
- You: column 4. With nothing urgent, the computer also plays column 4, on top of your disc.
- You: column 2. The computer stacks on column 4 again.
- You: column 3. You now hold columns 2, 3 and 4 on the bottom row, and both column 1 and column 5 complete four.
- The computer can plug only one (the left one, because of its leftmost tie-break). You play the other and win on your fourth move.
- Equivalent lines exist, such as 4, 3, 5 and then 6. The pattern is always three in a row with both ends open and playable. Against a person it works as soon as they stop looking two moves ahead.
Odd rows and even rows
Number the rows from the bottom, 1 to 6. The rule of thumb among experienced players: the player who moves first (red) wants threats on odd rows, and the player who moves second (green) wants threats on even rows.
The reason is arithmetic. Each column has 6 cells, an even number. If the second player always answers in the same column as the opponent, they end up with every even-row cell and the first player with every odd-row cell. That is why a red threat on row 3 or 5 is hard to neutralise, and so is a green threat on row 2, 4 or 6. Threats on the wrong parity rarely force the opponent to play underneath them.
What the maths says
In 1988 James Dow Allen and Victor Allis independently solved the game: with perfect play the first player wins, but only by opening in the centre column. Opening in either neighbouring column leads to a draw, and opening in any of the four outer columns hands the win to the second player.
That does not make it easy. There are more than four trillion possible positions on the 7×6 grid, and only a computer memorises the perfect path. The practical lesson for you: column 4 sits on 51 of the 69 possible ways to line up four, against 15 for an outer column.
Common mistakes
Most lost games here trace back to one of these.
- Dropping under your opponent's winning square. You hand over the square above.
- Blocking only the visible threat without noticing a second one behind it.
- Thinking only horizontally. Diagonals and verticals slip by, especially those starting in the side columns.
- Spending discs on the edges early. A disc in column 1 sits on only 3 to 5 lines and rarely builds anything.
- Relying on a simple threat against the computer. It blocks any immediate four; only a double threat works.
Tips for beginners
- Start in column 4 whenever you can.
- Count to three: when your opponent has three, check both ends.
- Before releasing a disc, look at the square directly above it.
- Against the computer, practise the three-on-the-bottom-row pattern, then look for the same shape higher up.
- Use 2-player mode to practise diagonals without pressure.
Trivia
- There are 69 ways to line up four on a 7×6 grid: 24 horizontal, 21 vertical and 24 diagonal.
- Every horizontal line of four passes through the centre column.
- Each player has 21 discs, exactly enough to fill all 42 squares, so a drawn game uses every disc.
- The standard grid has over four trillion legal positions, and yet the game is solved.
Mobile version
On a phone, tap any square of the column you want; you do not need to hit the top one. The grid takes up to 88% of the screen width, capped at 420 px, so there is no sideways scrolling and the squares stay big enough for a thumb. In 2-player mode red and green alternate automatically.
Frequently asked questions
Does moving first give an advantage?
Yes. With perfect play the first player wins by opening in the centre column; opening in a neighbouring column only draws. In practice the centre gives the first player more possible lines from the start.
Do diagonals count?
Yes. Four in a row horizontally, vertically or diagonally, in either direction, wins equally.
How does the computer choose its move?
In order: it wins if it can, blocks your immediate four, and otherwise prefers the columns closest to the centre (4, 3, 5, 2, 6, 1, 7). There is no randomness.
Can the computer be beaten?
Yes. It looks only one move ahead and always answers the same way. Three discs on the bottom row with both ends open, such as 4, 2, 3 and then whichever end is left, create a double threat it cannot stop.
Does the computer always play the same way?
Yes. There is no randomness: if you repeat the same moves, it repeats its replies. That lets you learn from a loss and test variations.
Can the game end in a draw?
Yes. If all 42 squares fill up with no four in a row, the game is drawn.
Can I undo a move?
No. Once the disc has dropped the move stands. Use the new-game button to start over.
Do I need to install anything or create an account?
No. Connect 4 runs straight in your browser, free and with no sign-up.