Solver · Live
Connect 4 Solver,
the best move for any position.
Use this free Connect 4 solver to find the best move in any four-in-a-row position. Tap columns or paste a move string such as 4453, and every column is scored: a proven win, loss or draw in a set number of moves, or a clearly labelled estimate.
Interactive
Connect 4 Solver
One digit per move, columns 1 to 7 from the left. The first digit is the first player's move.
Search time
Longer searches look further ahead. Positions with about 12 or more discs are often solved completely.
Tap a column to drop the first disc, or type a move string.
Field guide
How the Connect 4 Solver works.
Connect 4, also known as Four in a Row, is played on an upright grid seven columns wide and six rows tall. Players take turns dropping a disc into a column, where it falls to the lowest free square, and the first to line up four of their own discs horizontally, vertically or diagonally wins. If all 42 squares fill without a four, the game is a draw. This solver takes any position and tells you which column to play, and how sure it is.
Entering a position
Tap a column to drop a disc for the player whose turn it is. The first player's discs are amber and the second player's are violet. You can also type the game as a move string: each digit is a column from 1 to 7, in the order played, starting with the first player. The string 4453 means the centre column twice, then columns 5 and 3. Undo removes the last disc, and Example loads a practice position written for this tool. Positions are defined by their moves because the order tells the solver who plays next.
Reading the scores
Each column gets a label above it. Win in 3 means the player to move can force a win with their third disc from now, whatever the opponent does. Loss in 2 means the opponent can force a win on their second disc. Draw means neither side can force a win. These three labels are proofs. A number such as +12 is only an estimate: positive looks better for the player to move, negative looks worse.
Why it sometimes says “best within N plies”
A ply is one disc by one player. Looking ahead from an open board is far too much work to finish in a few seconds, so the search stops at its time budget and reports how deep it got. The answer is then the best move found within that many plies: a strong suggestion, not a proof. As discs go on the board the number of possible futures collapses, and from roughly twelve to fourteen discs most positions are searched to the very end. When that happens every label is a proof and the tool says the position is solved. The Deep setting buys more depth for a longer wait.
What the search does
The engine uses negamax with alpha-beta pruning: it assumes both sides choose their best reply and skips branches that cannot change the result. A transposition table remembers positions that arise from different move orders, including their mirror images. Columns are tried centre first, because central squares belong to the most possible fours. Iterative deepening searches one ply, then two, then three and so on, so a usable answer exists whenever time runs out. At every step two rules are applied without guessing: take an immediate win, and never play beneath a square where the opponent would win next. If the opponent threatens a single winning square, blocking it is the only reply considered.
Worked example
Enter 11223. The first player holds the bottom squares of columns 1, 2 and 3, and the second player sits on top of columns 1 and 2. It is the second player's turn, and column 4 would complete a bottom row for the first player. The solver marks every column except 4 as Loss in 1, because anything else lets the first player finish at once. Column 4, the block, is the only move that keeps the game alive. Now enter 112233: the same three discs, but it is the first player's turn, and column 4 reads Win in 1.
Tips for playing Connect 4
- Start in the centre. A disc in the middle column takes part in more possible fours than any other square.
- Think in rows. As a rule of thumb the first player wants winning squares on odd rows counted from the bottom, and the second player on even rows. The solver's estimates include a small bonus for this.
- Look for double threats. Two winning squares at once cannot both be blocked, so building toward one is how most games are won.
Disclaimer: This tool is an independent fan creation and is not affiliated with, authorized, or endorsed by Hasbro, Inc. “Connect 4” is a trademark of its respective owner. Provided for practice and entertainment only. Estimates come from a depth-limited search and can be wrong; only results labelled Win, Loss or Draw are proven.