ChessTB
Endgame tablebases

Endgames, solved under the rules you actually play.

Endgame tables that read the halfmove clock, keep castling rights and count every pawn push.

KRNKNN · White to move6k1/5n2/8/8/8/5n2/1RK5/1N6 w - - 0 1Open in explorer
The famous recordMate in 262
Under the 50-move ruleDraw

The clock is part of the position.

For more than three decades, the position above has been endgame theory's most famous record. White mates in 262 moves, but the rules end the game hundreds of plies before the mate. ChessTB stores the answer at every halfmove clock from 0 to 99.

KRNKNN · White to move · clock 07n/8/8/2R4N/8/8/2n5/K2k4 w - - 0 1Open in explorer
THE LONGEST MATE FROM A FRESH CLOCK, SAME ENDGAME

Without the rule this is mate in 69. Within the rule it is mate in 84.

The fastest mate takes too long between captures, so it can't be played. To keep the clock alive, White has to take a longer route, and with a fresh clock, the longest forced mate in this endgame is 84 moves. Only one first move keeps it: Kb2.

69moves to mate, ignoring the rule
84moves to mate, within the rule
50moves to the first capture with best play
KRNKNN · White to move · clock 828/8/8/8/R7/4nKN1/2n5/6k1 w - - 82 42Open in explorer
41 MOVES LATER

23 legal moves. One wins.

The halfmove clock reads 82. A table that ignores the clock reports 12 winning moves. The two fastest mates, Rf4 and Re4, are mate in 25 if you ignore the rule. On this clock, both are draws.

KQPPKQ · White to move8/4k3/8/Q7/8/7P/P7/q1K5 w - - 0 1Open in explorer
THE LONGEST MATE FROM A FRESH CLOCK, UP TO SIX PIECES

Mate in 184. The rule makes it longer.

Without the rule this is mate in 182. Within it, White needs two more moves. The next pawn move or capture is 97 halfmoves away, so at clock 3 it's still mate in 184. At clock 4, it's a draw.

182moves to mate, ignoring the rule
184moves to mate, within the rule
4clock at which the win is gone
KRPKN · White to move8/1n6/8/8/7k/8/1K4RP/8 w - - 0 1Open in explorer
SAME POSITION, DIFFERENT CLOCK

Move the clock. Watch the winning move change, then disappear.

Without the rule, Kc3 mates in 24. Within it, a higher clock leaves less room to reach the next capture or pawn move: the mate stretches, then Rd2 and Rg7 take over in turn. From clock 96, no move wins.

Castling, finally.

Endgame tables have always assumed nobody can castle. These positions show what that assumption hides. Each rook and king arrangement is indexed, so Chess960 is covered by the same tables.

KRKB · White to move8/8/3k4/8/8/8/8/R3K1b1 w Q - 0 1Open in explorer
ROOK AGAINST BISHOP

O-O-O+. A fork made by castling.

The rook lands on d1. It checks the king on d6 and, along the first rank the king has just left, attacks the bishop on g1. It's the only winning move, and it leads to mate in 17. Without the castling right, the same position is a draw.

KRKPP · White to move8/8/8/8/pk6/8/7p/R3K3 w Q - 0 1Open in explorer
ROOK AGAINST TWO PAWNS

The king is in the way. Castling moves it.

Black's h-pawn queens next move. The rook on a1 can't reach h1 because its own king is on e1. Castling moves the king and brings the rook to d1, covering h1, in one move. Out of 12 legal moves, it's the only one that wins. Kd2 clears the rank too, but one move slower, and only draws. Without the castling right, White can't win at all.

Every pawn push counted.

Captures and promotions change the material. Pawn pushes don't, but they can't be taken back. ChessTB counts how many pushes a win still needs before the next conversion, and finds the line that needs the fewest.

KRPKR · White to move2r5/8/8/8/1k6/8/5P1K/3R4 w - - 0 1Open in explorer
ROOK AND PAWN AGAINST ROOK

Three moves win. The obvious ones aren't the best.

1. Rb1+ Ka5 2. f4! Then f5, f6, f7, and the rooks come off on d8. Four pushes.

KRPKR · White to move8/5r2/3R4/8/6k1/8/1P6/3K4 w - - 0 1Open in explorer
A 35-MOVE WAIT FOR THE FIRST PUSH

Five pushes to go. The first one is 35 moves away.

White wins, but none of the b-pawn's five pushes can be played for 69 halfmoves. From clock 32, the win is gone.

5pushes still needed
35moves to the first push
32clock at which the win is gone

Go find the next Ra8.

Bring the ending you drew on move 87, the study you never trusted, or the Chess960 game where castling saved you. Enter the position with its clock and see what was true.

PiecesTablesAnswers
≤8WDL and DTZAt 8 pieces: Op1Win, draw or loss with the 50-move rule, and the distance to the next zeroing move
≤6DTMMate distance without the 50-move rule
≤6DTM50Mate distance at every halfmove clock from 0 to 99
≤6DTCEndgames with pawnsPawn pushes still needed before the next capture or promotion, and the distance to the next zeroing move

Every set includes tables with castling rights.

Free and libre. The source code and the table files are public domain: use, copy, modify and redistribute them for any purpose.