How Chess Engines Work (Minimax, Alpha-Beta, NNUE)

Modern chess engines beat the best human players by margins that would have seemed absurd thirty years ago. The engine running on a laptop today is stronger than any human who has ever lived. The interesting question isn’t whether they win — it’s how. The answer combines four classical algorithms with one neural-network development from the last six years, glued together by enormous amounts of computational tuning. Here’s how chess engines actually work, from the ground up.
Key takeaways
- Chess engines use minimax search to look ahead through possible moves, scoring positions and picking the best line.
- Alpha-beta pruning cuts the search tree dramatically by skipping branches that can’t beat what’s already been found.
- The evaluation function judges any non-terminal position; modern engines use NNUE neural networks for this since Stockfish 12 (2020).
- Opening books and endgame tablebases handle the start and end of the game with pre-computed data, freeing the search for the middlegame.
- Stockfish, Leela Chess Zero, and Komodo are the dominant engines in 2026, each with different architectural choices.
Step 1: The minimax search
At its core, a chess engine plays by looking ahead through possible moves and choosing the one that leads to the best position. The classical algorithm for this is minimax. The engine assumes both players will play optimally — itself maximizing its evaluation, the opponent minimizing it — and builds a game tree of possible move sequences several plies deep.
A “ply” is a single move by one side. Looking three plies ahead means: my move, opponent’s reply, my response. At each node in the tree, the engine evaluates the resulting position and propagates the values back upward. The move at the root that produces the highest score against optimal opponent play is the chosen move.
Minimax is conceptually simple but computationally explosive. Chess has an average of about 35 legal moves per position. A naive minimax search to depth 6 examines 35^6 ≈ 1.8 billion positions. To depth 10, it’s 2.7 quadrillion. Pure minimax is intractable for any non-trivial depth without optimization.
Step 2: Alpha-beta pruning
Alpha-beta pruning is the algorithm that makes minimax practical. The insight: once the engine has evaluated one move thoroughly, it can stop evaluating any move that the opponent could refute. If move A is known to result in evaluation +0.3 with best play, and the opening of move B already produces -1.0 against one opponent response, there’s no point exploring further — the opponent will choose that refutation, making B worse than A.
The two thresholds — alpha (the best value the maximizer is guaranteed) and beta (the best value the minimizer is guaranteed) — bracket the search. When alpha exceeds beta, the branch is “pruned” and skipped. Properly implemented, alpha-beta reduces the effective branching factor from 35 to roughly 6, which is enormous. A depth-12 search becomes practical instead of impossible.
The order in which moves are searched matters enormously for alpha-beta efficiency — if you search the best move first, more branches get pruned. Modern engines use heuristics (killer moves, history tables, transposition tables) to order moves before searching.
Step 3: The evaluation function
When the search reaches its target depth or a “quiet” position, the engine needs to score the resulting board. This is the evaluation function. Classical evaluation functions combine many handcrafted features: material count (queen = 9, rook = 5, etc.), piece activity, king safety, pawn structure, control of the center, mobility, and dozens of others. Each feature is weighted and summed into a single score, usually expressed in centipawns (hundredths of a pawn).
For decades, this handcrafted approach dominated. Engines like Stockfish (in its pre-NNUE form), Houdini, and Komodo all used variations of this approach with painstakingly tuned weights. The strength of an engine was largely a function of how cleverly its evaluation captured chess intuition.
Step 4: NNUE — the 2020 breakthrough
In 2020, Stockfish 12 integrated a neural-network evaluation function called NNUE (Efficiently Updatable Neural Network), originally developed for shogi engines by Yu Nasu. NNUE replaces the handcrafted evaluation with a small neural network trained on millions of positions.
The key engineering insight in NNUE is “efficient updatability.” Most neural networks are slow to evaluate because they require full forward passes through dense matrix multiplications. NNUE’s architecture is designed so that small changes to the position (a single move) require only small updates to the network’s hidden state, not a full recomputation. This makes NNUE fast enough to use inside the alpha-beta search at every leaf node.
The strength gain from NNUE was immediate and large — roughly 80 Elo points in Stockfish’s case, which is enormous in chess-engine terms. Modern Stockfish, Komodo Dragon, and several other engines now use NNUE-style evaluation functions trained on data generated by previous strong engines.
Step 5: Opening books
The opening phase of a chess game has been studied exhaustively by humans for over a century. There’s enormous theory on what moves are best in known positions — and the engine can use this directly. An “opening book” is a database of move sequences for the start of the game, with pre-computed best-move recommendations.
Engines that use opening books simply look up the current position in the book and play the recommended move, skipping the search entirely for the first ten or twenty moves. This conserves computation for the middlegame, where the position is no longer in the book and the search has to do real work. Most strong engines in tournament play use a curated opening book.
The opening book also handles the “Polyglot” format, a standard for representing opening trees that engines exchange and combine.
Step 6: Endgame tablebases
The endgame is the opposite of the opening — fewer pieces, fewer possible positions, more tractable to enumerate. For positions with seven or fewer pieces remaining, complete solutions exist as “endgame tablebases” — databases that record the optimal move and the outcome (win/loss/draw and the distance to mate) for every possible position.
The Syzygy tablebases (released by Ronald de Man) and the older Nalimov tablebases are the standard formats. When a game reaches a position with few enough pieces, the engine consults the tablebase and gets the perfect move without search. This guarantees flawless endgame play in any reachable tablebase position.
The largest current tablebases cover seven-piece endgames. Generating eight-piece tablebases is a multi-petabyte computational project that’s still in progress in 2026.
How the pieces fit together
A modern chess engine in 2026 plays a move roughly like this:
- Check the opening book. If the position is in the book, play the book’s recommended move and skip everything else.
- Check the endgame tablebase. If the position has few enough pieces to be in the tablebase, play the perfect move.
- Run alpha-beta search to a target depth (or under a time budget), using NNUE to evaluate leaf positions.
- Apply move-ordering heuristics, transposition tables, late-move reductions, and other refinements to make the search efficient.
- Return the move at the root with the best evaluated outcome.
The whole pipeline runs in fractions of a second per move at amateur time controls, and pushes deeper than 30 plies in tournament time controls on modern hardware.
Leela Chess Zero — the alternative architecture
Stockfish and its successors use alpha-beta search with NNUE evaluation. The other major engine, Leela Chess Zero, takes a fundamentally different approach inspired by DeepMind’s AlphaZero. Leela uses Monte Carlo Tree Search (MCTS) with a deep convolutional neural network for both evaluation and move-selection priors.
Leela doesn’t do exhaustive alpha-beta search. Instead, it grows a search tree probabilistically — exploring promising lines deeply and likely-bad lines shallowly. The neural network is much larger than NNUE (millions of parameters versus thousands) and slower to evaluate, but the MCTS framework compensates by being more selective about which positions to evaluate.
Stockfish and Leela trade matches with roughly comparable strength in 2026, with the lead changing across hardware configurations and time controls. The two architectures represent different bets about where the computational budget is best spent.
What this all means for human players
The strength gap between the best engines and the best human players is now unbridgeable. Magnus Carlsen, the highest-rated human player in history, would lose match after match to a modestly tuned Stockfish running on a laptop. But the engines are also enormous study tools — modern preparation involves running engine analysis on every line, identifying mistakes that would have been invisible to human analysis a generation ago.
The engines have also reshaped the opening landscape. Some openings that humans considered marginal turned out to be sound under engine analysis; others that were considered strong turned out to be drawn or worse. The competitive chess world’s understanding of theory has been updated, line by line, against engine recommendations.
For more on the strategic side of the human game, see our games like chess piece on the wider chess-and-chess-adjacent universe.
What’s missing from this picture
Two things. First, the engines play differently than humans. They find moves that look ugly or counterintuitive but turn out to be objectively best. Human-style play and engine-style play diverge in subtle ways that have generated their own field of analysis.
Second, computational chess isn’t “solved.” Eight-piece tablebases are years from completion. Full chess from the starting position is far beyond current computational reach — the game tree is on the order of 10^120 positions, and no amount of pruning gets close to tractable from the root. The engines are excellent within their lookahead window but they’re not solving the game in any meaningful sense.
Frequently asked questions
What is the strongest chess engine in 2026?
Stockfish and Leela Chess Zero are the two dominant engines, trading top spots across various tournaments and time controls. Their architectures differ — Stockfish uses alpha-beta with NNUE; Leela uses Monte Carlo Tree Search with a deeper neural network. Both are open-source.
What does NNUE stand for?
Efficiently Updatable Neural Network. The “efficiently updatable” part is the key innovation — the network’s hidden state can be updated incrementally as moves are made, rather than recomputed from scratch, which is what makes it fast enough to use inside an alpha-beta search.
Did AlphaZero beat Stockfish?
In 2017, DeepMind’s AlphaZero won a match against Stockfish 8. The match conditions were debated at the time (Stockfish was running without an opening book and with limited hash memory), but the result showed that neural-network-based engines could compete with traditional alpha-beta engines. Modern Stockfish, with NNUE, has closed the gap and may have surpassed AlphaZero on equivalent hardware.
How deep can chess engines search?
In tournament time controls (multiple minutes per move), modern engines routinely reach 30–40 plies deep, with selective extensions reaching much deeper on critical lines. The depth varies by position complexity and the engine’s move-ordering quality.
Are opening books and tablebases cheating?
Not in any chess-engine context — they’re standard tools and are allowed in all major engine tournaments. The Computer Chess Championship and TCEC events all permit opening books and tablebases. The argument that they “aren’t really playing chess” is a philosophical question rather than a competitive rule.
The takeaway
Chess engines combine classical algorithms (minimax, alpha-beta, opening books, endgame tablebases) with modern neural networks (NNUE in Stockfish, deep convolutional networks in Leela) to play chess at a level no human can match. The architecture is more elegant than people assume — five well-understood components tied together carefully. For an entirely different algorithm-driven browser game, the Chrome Dino game has been the subject of its own neural-network experiments (notably Code Bullet’s 2018 NEAT-algorithm video), demonstrating that even one-button games invite the same kind of computational analysis.








