Chess Move Calculator: How Stockfish Searches for the Best Move

How a chess move calculator like Stockfish works: search tree, depth and seldepth, NNUE evaluation, MultiPV lines, and settings that change the answer.

A chess move calculator works in two parts. A search explores legal moves and replies several moves deep, cutting off lines that cannot matter. An evaluation — in Stockfish, a neural network called NNUE — scores the positions at the end of those lines. The move whose line scores best, assuming both sides play their best replies, is shown as the top move. Deeper searches see more, which is why the suggestion can change as the engine keeps thinking.

Why brute force is impossible

The number of possible move sequences grows explosively. We counted every legal sequence from the starting position with the chess.js move generator (a "perft" count):

Legal move sequences from the starting position
Plies (half-moves)Sequences
120
2400
38,902
4197,281

Every extra ply multiplies the tree by roughly 20 to 30. A 20-ply search done by brute force would be hopeless, yet engines routinely report depths of 20 and beyond. They get there by not looking at most of the tree.

How the search works

Stockfish uses alpha-beta search with iterative deepening: it searches to depth 1, then 2, then 3, and so on, reusing what it learned each time.

  • Alpha-beta pruning. Once the engine finds a reply that refutes a move, it stops examining that move further. Good move ordering makes this cut enormous.
  • Reductions and extensions. Unpromising moves are searched shallower; forcing ones like checks and captures are searched deeper.
  • Transposition table (Hash). Positions reached by different move orders are stored and reused instead of recalculated.

Stockfish's own FAQ defines depth as "the counter of the iterative deepening loop at the root of the game tree," and notes that because of pruning, reductions, and extensions, lines do not all reach the same depth (Stockfish FAQ). Seldepth is the deepest line the search actually reached. So "depth 22" does not mean every move was checked 22 plies ahead.

How the evaluation works: NNUE

At the end of each line the engine needs a score. Modern Stockfish uses NNUE (efficiently updatable neural network), trained on huge numbers of positions. It judges material, king safety, piece activity, and pawn structure together, instead of with hand-written rules. The Stockfish FAQ says NNUE "gives stronger play" than the older hand-crafted evaluation, although each evaluation is slower.

Stockfish also normalizes its score so that +1.00 (100 centipawns) corresponds to about a 50% chance of winning in its self-play testing (Stockfish FAQ). That is why a "one-pawn" score is a win-chance statement, not a pawn count. The full guide to scores is in how to read chess engine evaluations.

Settings that change the answer

These are the main UCI options documented on the Stockfish UCI & Commands page:

Stockfish settings and their effect on analysis
SettingWhat it doesPractical effect
depth / movetimeStop at a given depth or after a given number of millisecondsMore time means more reliable lines, with diminishing returns
MultiPVOutputs the N best lines instead of oneLets you compare candidates; the docs advise 1 for maximum strength
ThreadsCPU threads used for searchingMore threads search faster; results can vary slightly run to run
HashSize of the transposition table in MBLarger tables help on long analyses
UCI_ShowWDLAdds approximate win/draw/loss figuresConverts a score into expected outcomes

MultiPV is the setting learners should care about. With one line, you see only the winner. With three, you see whether the top move is uniquely good (a big gap to the second line) or one of several equal choices (scores within a few hundredths). A big gap means the position demands precision; a small gap means play the move you understand.

Watch it on a position

White to move. A knight fork wins the queen: 1. Nc7+ checks the king on e8 and attacks the queen on a8. Every one of Black's five legal replies is a king move, and 2. Nxa8 follows.

q3k3/8/8/3N4/8/8/8/6K1 w - - 0 1

Open this position in the analysis board →

Turn on several lines and watch: Nc7+ jumps to the top almost instantly, because the search finds the forcing check first and the cut-offs make everything else cheap to refute. In quiet positions, by contrast, the top moves can swap places for many depths before settling.

What this means when you use the calculator

  • Let the depth climb before trusting a close call.
  • Read the whole principal variation, not just the first move.
  • Treat small gaps between lines as "both fine."
  • The engine's score is an estimate from its search, not a proof — except when it reports a forced mate.

Our analysis board and homepage move finder run Stockfish 17.1 in your browser, free, with no account. For a full game, use game review. If you are deciding between tool types, see chess solver vs chess helper; if you want to find moves yourself first, use the best-move thinking checklist.

Ready to find your next move?

Set up the position and let Stockfish show you what it sees.

Try the move finder →