Tools

Connect 4 solver

Perfect-play analysis of any Connect 4 position.

Click a column to drop a stone, then watch the solver work out the best reply. It runs entirely in your browser — nothing is sent to our servers.

Yellow to move5 stones played
Empty cell at row 5, column 1Empty cell at row 5, column 2Empty cell at row 5, column 3Empty cell at row 6, column 4Empty cell at row 6, column 5Empty cell at row 5, column 6Empty cell at row 5, column 7
  • Red stone at row 6, column 1
  • Red stone at row 6, column 2
  • Red stone at row 6, column 3
  • Yellow stone at row 6, column 6
  • Yellow stone at row 6, column 7

Engine evaluation

Searching

Calculating…

Running the solver in a background worker so the board stays responsive.

How to use

  1. Click any column to drop a stone — red plays first. The board turns alternate automatically.
  2. After each move the solver searches the game tree and highlights the column it recommends next.
  3. Use Undo to take back a move or Reset to start a fresh game. Your game is saved automatically in your browser.
  4. Turn off Highlight best move if you want to test yourself without the engine spoiling the answer.
  5. Copy link to position puts the whole game in the URL, so you can share a position or come back to it later.

Key positions to try

Each of these opens the board at that position, with the engine's verdict alongside it.

Frequently asked questions

How strong is the solver?

It uses the same bitboard negamax algorithm as Pascal Pons' open-source solver with alpha-beta pruning, a transposition table and centre-first move ordering. From any mid- or late-game position it plays perfectly. On a nearly-empty board it may hit its time budget and return the best move found so far.

Does Red always win with perfect play?

Yes — Connect 4 was mathematically solved in 1988. The first player wins if they drop the first stone in the centre column and then play perfectly. Any other first move draws or loses.

Is my game saved?

Yes — the moves you've played are stored in your browser's local storage, so the board is still there when you come back. Nothing is sent to our servers; clearing your browser data will remove it.

Where does the solver run?

Entirely in your browser, inside a Web Worker so it doesn't block the board while it thinks. Because it's client-side you can use it fully offline after the first load.

Can I share a position?

Yes. Copy link to position writes the move list into the URL, so anyone opening that link sees the same board and the same analysis. The link works offline too, since the solver runs in your browser.

Built for quick games and friendly rematches.