Connect 4 Online vs Computer
Play the classic Connect 4 (Connect Four, four-in-a-row) directly against the computer — free, in your browser, with no download and no sign-up. Drop red discs into the blue 7×6 board and line up four before the AI does. This is a single-player game built around an honest AI opponent: Beginner deliberately makes mistakes you can punish, Medium plays a solid tactical game, and Hard runs an extremely strong search engine that thinks about a second per move. You can choose who goes first, undo your last exchange, and your wins, losses and draws are tracked per difficulty in your browser.
How the AI thinks
The opponent here is not a set of canned tricks — it is a real game-tree search engine, the same family of algorithm used by classic chess programs. The board is stored as bitboards: each player's discs live in a single 64-bit number, so testing "is there a four in a row?" takes just a handful of bit operations. On top of that the engine runs negamax with alpha-beta pruning: it plays out possible futures for both sides, scores the outcomes, and picks the move with the best guaranteed result, skipping branches that provably cannot matter. A transposition table remembers positions reached by different move orders so they are only analysed once, and iterative deepening lets Hard search as deep as its time budget allows — in our measurements, depth 15 in the opening and 19 or more in the midgame, examining on the order of a million positions per move. The whole engine runs locally in your browser (in a background worker thread, so the page stays responsive), and nothing is sent to a server.
One honest note: Connect 4 is a solved game — with perfect play from both sides, the first player wins by starting in the center column. Our Hard engine is extremely strong against human play, but we don't claim it is perfect. That's also your way in: see the tips below.
How to play Connect 4 — the rules
- Take turns dropping discs. Click or tap a column and your disc falls to the lowest empty cell. Red (you by default) and yellow (the AI) alternate.
- Connect four to win. The first player to line up four discs of their color — horizontally, vertically or diagonally — wins the game. The winning line lights up.
- Full board = draw. If all 42 cells fill with no four-in-a-row, the game is drawn.
- Undo and restart freely. Undo takes back your last move (and the AI's reply). New Game starts over with your current settings.
Tips to beat the AI
- Claim the center. The middle column sits in more possible four-in-a-row lines than any other — control it and your options multiply.
- Build double threats. A single threat gets blocked; two open threats at once cannot both be answered. Look for moves that create two ways to win.
- Watch the odd and even rows. In Connect 4 endgames, threats on odd rows (counting from the bottom) tend to favor the first player and even rows the second — plan which threats will still matter when the board fills up.
FAQ
Can I play Connect 4 online against the computer?
Yes — that is exactly what this page is. Pick a difficulty, choose who moves first, and play. Works on desktop and mobile, free, with no account.
How strong is the AI?
Beginner deliberately plays some random moves. Medium always takes an immediate win and blocks yours. Hard searches roughly 15–19 moves deep with about a second of thinking per move — extremely strong, though we don't claim perfection.
Can I go first?
Yes, and it matters: Connect 4 is solved, and with perfect play the first player wins. Letting the AI start makes every level harder.
Is there a two-player mode?
No — like every game on the LK Forge games hub, this one is deliberately built around playing against a real AI.
Is it free? Does it work offline?
Completely free, no download, no sign-up. The engine runs client-side, so once loaded the game keeps working without a connection. More AI games: AI Chess, AI Checkers, AI Othello, AI Tic Tac Toe or AI Minesweeper.
More AI games on LK Forge
You win!
Four in a row.