# Has anyone done a correlation of castling with winning and losing?

I saw this question: How often does castling occur in grandmaster games?
The statistics are interesting. The answer states that they do so about 90% of their games.

So, the move seems pretty valuable. But this then prompted in my mind the question -- has anyone done an analysis that would further prove that it is a good idea to castle? I mean, every game is unique, but does castling correlate with winning?

(I'm thinking of a straightforward ratio, simple differential analysis, a comparative winning percentage in the two subsets. But getting a valid answer might require deeper skill with statistics than I possess if there are subtleties here.)

Also, I suppose that if one can do this analysis, one could further break down the question into the comparative gain/loss of kingside and queenside castling.

EDIT: Sorry if this causes too much discussion of refining my question. I certainly am inviting someone to do such a statistical analysis, looking for correlations. But I was mainly asking if someone had already done any such thing -- asking: "Do you know of a paper/article treatment of it?" (Mind you, not one that just gives advice, but one that calculated some statistics from a game database.)

If we are going to try to work out the exact formulation of the items that could be measured, and then find a database and use the tools to perform it, that is a much harder question.

• The modern self learning AI chess engines are totally dependant on analysing past game and they do choose to castle. Commented Feb 7, 2022 at 9:20
• In chess, analisis is a much more powerful tool than statistics. Analisis has proven that on many positions, castling is a good idea. Commented Feb 7, 2022 at 14:46
• A straight forward ratio seems difficult to achieve here: How would draws be treated? How would treat games where both parties castle be treated if there is a result? Commented Feb 7, 2022 at 15:40
• @SecretAgentMan The fact that 'self-learning' (i.e. learnt by self-play) engines decide to castle is precisely what IanRingrose is citing as evidence that castling is often advantageous Commented Feb 7, 2022 at 22:42
• cf chess.stackexchange.com/questions/8856/… Kaufman (creator of Komodo and founding father of engine chess) did some experiments to test how much of a disadvantage not being able to castle is for computers. TLDR it's a pretty big one Commented Feb 7, 2022 at 22:45

I calculated some statistics on games published by TWIC (issues 920-1437). After some cleaning and filtering of the database (see Methodological notes at the end), I had some 1.7 million games to work with of players rated 1000 to Magnus Carlsen.

# Castling vs. not castling

The first question is whether castling is associated with winning more often. The following table shows the average score in the database for white and black when castling and not castling.

White Black
Castling 0.540 0.468
Not castling 0.518 0.424

So, yes, not castling is associated with having a worse score in average (no surprise here). Now, this can mean several things:

• Not castling is detrimental for your play (in general).
• The better player doesn't let the other one castle, and profits from this.
• The not-castling player loses before even being able to castle.

# Castling long vs. Castling short

Another question I considered is about the differences when castling long or short, same side or opposite side. The next table shows the results for white. (The results for black are just the opposite.)

% White Wins % White Draws White score
O-O / O-O 39.4 27.8 0.533
O-O / O-O-O 43.1 19.9 0.530
O-O-O / O-O 44.5 19.9 0.545
O-O-O / O-O-O 41.8 26.4 0.551

There are small differences in score when castling one side or the other. The most clear changes are in the percentage of draws: castling same side is a little more drawish. And it is well known that castling on opposite sides brings a more imbalanced position.

The data indicates also that white's score is highest when both players castle long.

# The time of castling

Finally, a more interesting question is if it does matter when you castle. The following chart shows the proportion of wins and draws for different distances between both players castling. A difference of 0 means both players castle on the same move; a difference of 10 means white castles 10 moves later than black; a difference of -10 means black castles 10 moves later than white.

The proportion of draws is greatest when both players castle at the same time. While the proportion of wins increases with the distance between castling moves, with advantage (in average) for the player who castles last.

Does this mean that castling later pays off? Or rather, that the openings that let you castle later are favorable for you? I'd guess the key here is maintaining the uncertainty on which side you're going to castle, and then castling at the most convenient time and on the most convenient side. Of course, not all openings let you do that...

# Methodological notes

I used a collection of games published on TWIC (issues 920-1437) and parsed them to extract the necessary information using a custom made Python script. I kept all games with a normal result ('1-0', '0-1', '1/2-1/2'), where the Elo of players was known, where the ECO was noted, and with an initial FEN position not specified.

• Very nice work! As I said in one of my comments, someone actually doing the statistics here and now, was more than I had hoped for as a response. I still agree with the points that @IT_M made -- essentially that one needs to be careful not to casually apply these results. But I think what you've shown here is excellent. Commented Jun 3, 2022 at 22:30
• @MarkGoldfain Thanks! And sure, I do agree too. In the end, it is the position at hand that matters. Commented Jun 4, 2022 at 17:24
• It may be the case that late castling appears to be advantageous because early castling is caused by the opponent playing aggressive moves which threaten the king (e.g. early Bb4/Bb5/etc. pins, early attacks on f2/f7, etc.) and force the player into a more defensive posture. Commented May 29 at 18:52

Just as you pointed out castling vs no castling win-loss rate depends on some factors like time control, playing style, etc. It is different for different players and would be better if you take a look at these statistics for individual players rather than overall stats.

Some online chess websites have the option to get insights from your game(s).

Chess.com has a paid feature which you can take a look at by going to Chess Insights.

Here are the insights from GM Hikaru Nakamura's games

Lichess provides you with a similar Insights feature at no cost. You can check it out by going here.

Here are some insights from my games:

As you can see the rate of losing the game is slightly higher when you Don't castle!

• Does "No castling" refer to (1) not castling in a normal game or (2) a variant of chess where castling is not permitted at all? Commented May 25, 2022 at 16:45
• @SecretAgentMan (1) Not castling in a normal game. Commented May 25, 2022 at 17:41
• Thanks. Lacking that there is a wider treatment by some researcher, this is a helpful result. I think for me, as a rank amateur player, I have often let the opportunity to castle pass me by. I don't have enough personal data to change this behavior, but I think there is an answer out there, somewhere. I should plan to set it up and make use of the castling move more often. Commented May 26, 2022 at 18:13

Your question will by its definition generate useless data, whilest your intent is very useful.

As @AbhyudayVaish pointed out, there are a lot of paid/free tools available that give you insights in the win/loss rate when castling (or not).

These 'insights' will lack nuances since:

1. There are openings that do have a good reputation when not castling (e.g. the Yuguslav variation of the Benko Gambit Accepted and a lot of variations in the Berlin Defense), so your stats might vary whether you often play those kind of openings or not. Better is to eliminate these games from the comparison.
2. Depending on the strength of the opponent not castling might be beneficial to you. (Much) weaker opponents might struggle punishing the lack of castling when it is beneficial. E.g. in my stats I actually have a higher score against weaker players (+5%) when not castling. Better is to only review performance against similar ratings.

Also note that castling just for the sake of castling (or because the opponent does it) is not the best motive to do it.

Let's assume we compare to similar rated opponents and we filter out most of those specific variations, then the answer to your question is the loss rate is at least 5 to 10% higher when not castling.

In short: there is a clear correlation to not castling and losing.

Maybe all those chess teachers and GMs are right after all? :-)

For the record: the afore mentioned scores are based on the stats of three GMs and my own, so it's not really statistically representative.

• Yes, when I formulated the question, it sounded reasonable. But now I realize that it is very hard to sort it out. Like any other move a player might make, it will be embedded in a larger strategy -- and it will succeed or fail along with the strategy. And finally, whether one can find a correlation with winning or not, clearly castling can accomplish a powerful change in one's attack and defense posture in a given board position, so it should be used when one sees it giving a desired effect. Commented May 26, 2022 at 18:07

Here is a sample game between stockfish 15 and Stockfish 15 setup with white that cannot castle and black that can castle through the use of a starting position where white castle flag is none.

### White cannot castle but black can

FEN: `rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w kq - 0 1`
Time control: 1hr + 30s inc.
Hash mb: 512
Condition: Black can castle, white cannot

``````[Event "Engine match"]
[Site "?"]
[Date "2022.05.25"]
[Round "1"]
[White "Stockfish 15"]
[Black "Stockfish 15"]
[Result "1/2-1/2"]
[FEN "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w kq - 0 1"]
[SetUp "1"]
[TimeControl "3600+30"]

1.d4 { [%emt 0:04:19] [%eval -44,37] } 1...d5 { [%emt 0:01:58] [%eval -55,35] } 2.c4 { [%emt 0:00:42] [%eval -44,31] } 2...dxc4 { [%emt 0:00:49] [%eval -62,30] } 3.e3 { [%emt 0:01:52] [%eval -46,36] } 3...e6 { [%emt 0:01:51] [%eval -49,34] } 4.Nc3 { [%emt 0:00:50] [%eval -41,33] } 4...c5 { [%emt 0:03:10] [%eval -54,38] } 5.Nf3 { [%emt 0:01:16] [%eval -38,32] } 5...Nf6 { [%emt 0:01:47] [%eval -62,36] } 6.Bxc4 { [%emt 0:01:41] [%eval -29,35] } 6...Nbd7 { [%emt 0:00:44] [%eval -60,33] } 7.e4 { [%emt 0:01:02] [%eval -37,38] } 7...cxd4 { [%emt 0:01:48] [%eval -48,34] } 8.Nxd4 { [%emt 0:01:27] [%eval -20,35] } 8...Bb4 { [%emt 0:02:57] [%eval -34,37] } 9.f3 { [%emt 0:01:59] [%eval -33,38] } 9...O-O { [%emt 0:01:00] [%eval -47,31] } 10.Be2 { [%emt 0:01:10] [%eval -36,36] } 10...Qe7 { [%emt 0:04:06] [%eval -38,38] } 11.a3 { [%emt 0:02:47] [%eval -38,38] } 11...Bxc3+ { [%emt 0:00:58] [%eval -43,37] } 12.bxc3 { [%emt 0:00:53] [%eval -32,38] } 12...Nc5 { [%emt 0:04:56] [%eval -37,44] } 13.Nb3 { [%emt 0:01:09] [%eval -42,37] } 13...Nfd7 { [%emt 0:01:04] [%eval -40,39] } 14.Be3 { [%emt 0:01:11] [%eval -25,41] } 14...b6 { [%emt 0:01:05] [%eval -47,38] } 15.a4 { [%emt 0:02:49] [%eval -21,39] } 15...Rd8 { [%emt 0:03:15] [%eval -41,37] } 16.Qc2 { [%emt 0:01:27] [%eval -18,40] } 16...Qh4+ { [%emt 0:01:32] [%eval -28,37] } 17.g3 { [%emt 0:01:28] [%eval -11,42] } 17...Qf6 { [%emt 0:01:40] [%eval -22,38] } 18.Nxc5 { [%emt 0:01:14] [%eval -11,41] } 18...Nxc5 { [%emt 0:01:29] [%eval -19,42] } 19.Kf2 { [%emt 0:01:16] [%eval -12,41] } 19...Ba6 { [%emt 0:01:24] [%eval -12,43] } 20.Bd4 { [%emt 0:01:30] [%eval -10,42] } 20...Qe7 { [%emt 0:04:48] [%eval -14,41] } 21.Bxa6 { [%emt 0:01:20] [%eval -20,40] } 21...Nxa6 { [%emt 0:02:19] [%eval -12,40] } 22.a5 { [%emt 0:01:31] [%eval -11,41] } 22...Rac8 { [%emt 0:01:10] [%eval -14,43] } 23.Rhd1 { [%emt 0:02:24] [%eval -9,44] } 23...Nc5 { [%emt 0:01:02] [%eval -14,39] } 24.Kg2 { [%emt 0:01:39] [%eval -6,39] } 24...h6 { [%emt 0:01:00] [%eval -12,38] } 25.axb6 { [%emt 0:03:05] [%eval -8,40] } 25...axb6 { [%emt 0:01:12] [%eval -12,41] } 26.Bf2 { [%emt 0:00:50] [%eval -6,37] } 26...Rd7 { [%emt 0:01:34] [%eval -7,38] } 27.Qe2 { [%emt 0:01:38] [%eval -6,51] } 27...Rb7 { [%emt 0:03:03] [%eval -9,38] } 28.Qb5 { [%emt 0:01:44] [%eval -10,40] } 28...Qc7 { [%emt 0:01:05] [%eval -7,40] } 29.Rd4 { [%emt 0:01:35] [%eval -8,47] } 29...Kh7 { [%emt 0:01:06] [%eval 0,46] } 30.c4 { [%emt 0:01:11] [%eval 0,46] } 30...Nd7 { [%emt 0:00:56] [%eval 0,44] } 31.Rad1 { [%emt 0:01:06] [%eval 0,53] } 31...Nf8 { [%emt 0:01:02] [%eval 0,49] } 32.h4 { [%emt 0:01:13] [%eval 0,49] } 32...f6 { [%emt 0:01:00] [%eval 0,50] } 33.h5 { [%emt 0:01:08] [%eval 0,51] } 33...e5 { [%emt 0:01:02] [%eval 0,53] } 34.Rd6 { [%emt 0:01:09] [%eval 0,54] } 34...Qxc4 { [%emt 0:01:15] [%eval 0,59] } 35.Qxc4 { [%emt 0:01:40] [%eval 0,58] } 35...Rxc4 { [%emt 0:01:19] [%eval 0,58] } 36.Rxb6 { [%emt 0:02:03] [%eval 0,59] } 1/2-1/2
``````

Black has the advantage for sure, but could not win it.

### White can castle but black cannot

FEN: `rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQ - 0 1`

``````[Event "Engine match"]
[Site "?"]
[Date "2022.05.25"]
[Round "1"]
[White "Stockfish 15"]
[Black "Stockfish 15"]
[Result "1/2-1/2"]
[FEN "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQ - 0 1"]
[SetUp "1"]
[TimeControl "3600+30"]

1.e4 { [%emt 0:01:45] [%eval 82,34] } 1...c5 { [%emt 0:01:50] [%eval 97,36] } 2.Nf3 { [%emt 0:00:48] [%eval 111,34] } 2...Nc6 { [%emt 0:02:33] [%eval 105,33] } 3.d4 { [%emt 0:03:30] [%eval 109,34] } 3...cxd4 { [%emt 0:00:43] [%eval 100,33] } 4.Nxd4 { [%emt 0:00:57] [%eval 131,33] } 4...e5 { [%emt 0:01:13] [%eval 93,33] } 5.Nb5 { [%emt 0:01:54] [%eval 117,37] } 5...d6 { [%emt 0:02:02] [%eval 102,35] } 6.c4 { [%emt 0:01:01] [%eval 112,36] } 6...Be6 { [%emt 0:01:06] [%eval 107,34] } 7.Be2 { [%emt 0:03:19] [%eval 138,36] } 7...g6 { [%emt 0:05:48] [%eval 116,37] } 8.O-O { [%emt 0:04:57] [%eval 114,38] } 8...h5 { [%emt 0:00:46] [%eval 91,32] } 9.N1c3 { [%emt 0:00:52] [%eval 127,35] } 9...a6 { [%emt 0:01:41] [%eval 90,34] } 10.Na3 { [%emt 0:01:08] [%eval 124,37] } 10...f5 { [%emt 0:01:11] [%eval 92,32] } 11.exf5 { [%emt 0:01:37] [%eval 142,32] } 11...gxf5 { [%emt 0:01:17] [%eval 93,32] } 12.Nd5 { [%emt 0:01:29] [%eval 124,32] } 12...Rc8 { [%emt 0:01:23] [%eval 100,33] } 13.f4 { [%emt 0:03:08] [%eval 141,35] } 13...Nf6 { [%emt 0:07:48] [%eval 107,38] } 14.fxe5 { [%emt 0:02:38] [%eval 147,35] } 14...dxe5 { [%emt 0:00:52] [%eval 89,32] } 15.Bg5 { [%emt 0:00:48] [%eval 140,36] } 15...Be7 { [%emt 0:01:03] [%eval 93,33] } 16.Bxf6 { [%emt 0:03:22] [%eval 117,40] } 16...Bxf6 { [%emt 0:01:07] [%eval 78,33] } 17.Nc2 { [%emt 0:01:09] [%eval 114,38] } 17...Bg5 { [%emt 0:03:57] [%eval 100,39] } 18.Bxh5+ { [%emt 0:02:40] [%eval 103,40] } 18...Kf8 { [%emt 0:00:52] [%eval 93,37] } 19.Bg4 { [%emt 0:02:35] [%eval 100,39] } 19...Ne7 { [%emt 0:01:40] [%eval 106,38] } 20.Bxf5 { [%emt 0:01:09] [%eval 115,39] } 20...Nxf5 { [%emt 0:01:12] [%eval 103,41] } 21.Nce3 { [%emt 0:01:13] [%eval 118,40] } 21...Bxe3+ { [%emt 0:01:31] [%eval 108,42] } 22.Nxe3 { [%emt 0:01:26] [%eval 110,46] } 22...Qb6 { [%emt 0:01:41] [%eval 109,44] } 23.Qb3 { [%emt 0:01:31] [%eval 109,42] } 23...Qxb3 { [%emt 0:01:15] [%eval 97,48] } 24.axb3 { [%emt 0:01:33] [%eval 99,44] } 24...Rh5 { [%emt 0:01:36] [%eval 94,46] } 25.g4 { [%emt 0:01:15] [%eval 122,45] } 25...Rg5 { [%emt 0:01:20] [%eval 93,49] } 26.Ra5 { [%emt 0:02:09] [%eval 99,47] } 26...Ke8 { [%emt 0:01:19] [%eval 95,48] } 27.Rxe5 { [%emt 0:01:16] [%eval 99,51] } 27...Kd7 { [%emt 0:01:04] [%eval 99,47] } 28.Rd1+ { [%emt 0:01:08] [%eval 98,52] } 28...Kc7 { [%emt 0:01:02] [%eval 90,51] } 29.Rxe6 { [%emt 0:01:24] [%eval 98,49] } 29...Nxe3 { [%emt 0:01:11] [%eval 90,50] } 30.Rxe3 { [%emt 0:01:03] [%eval 98,54] } 30...Rxg4+ { [%emt 0:01:19] [%eval 90,50] } 31.Rg3 { [%emt 0:01:12] [%eval 98,54] } 31...Rh4 { [%emt 0:11:53] [%eval 89,51] } 32.Rg7+ { [%emt 0:02:37] [%eval 97,51] } 32...Kb6 { [%emt 0:00:52] [%eval 33,34] } 33.Rdd7 { [%emt 0:04:29] [%eval 95,38] } 33...Rb8 { [%emt 0:00:46] [%eval 32,37] } 34.Rg3 { [%emt 0:07:18] [%eval 28,45] } 34...Re8 { [%emt 0:01:04] [%eval 10,37] } 35.Rd2 { [%emt 0:01:56] [%eval 12,43] } 35...Re7 { [%emt 0:01:58] [%eval 9,40] } 36.h3 { [%emt 0:00:21] [%eval 12,39] } 36...Kc5 { [%emt 0:00:43] [%eval 4,44] } 37.Kf2 { [%emt 0:00:41] [%eval 10,38] } 37...Rf4+ { [%emt 0:01:20] [%eval 3,49] } 38.Kg2 { [%emt 0:00:32] [%eval 8,51] } 38...Kb4 { [%emt 0:00:56] [%eval 3,52] } 39.Rc3 { [%emt 0:00:30] [%eval 8,45] } 39...Rfe4 { [%emt 0:00:53] [%eval 3,46] } 40.Kf2 { [%emt 0:00:31] [%eval 7,43] } 40...Rf4+ { [%emt 0:00:37] [%eval 3,51] } 41.Kg3 { [%emt 0:00:37] [%eval 7,46] } 41...Rfe4 { [%emt 0:00:37] [%eval 3,50] } 42.Rf3 { [%emt 0:00:52] [%eval 7,46] } 42...Re1 { [%emt 0:00:32] [%eval 3,50] } 43.Kg2 { [%emt 0:00:40] [%eval 7,46] } 43...Rg7+ { [%emt 0:00:30] [%eval 2,47] } 44.Kh2 { [%emt 0:00:27] [%eval 0,47] } 44...Rge7 { [%emt 0:00:35] [%eval 2,48] } 45.Rg2 { [%emt 0:00:26] [%eval 0,47] } 45...Rd1 { [%emt 0:00:43] [%eval 2,47] } 46.h4 { [%emt 0:00:39] [%eval 0,49] } 46...Rh7 { [%emt 0:00:32] [%eval 0,52] } 47.Rh3 { [%emt 0:00:58] [%eval 0,50] } 47...Re1 { [%emt 0:00:28] [%eval 0,54] } 48.h5 { [%emt 0:00:31] [%eval 0,54] } 48...Re5 { [%emt 0:00:29] [%eval 0,57] } 49.h6 { [%emt 0:00:25] [%eval 0,55] } 49...Re6 { [%emt 0:00:30] [%eval 0,62] } 50.Rg7 { [%emt 0:00:40] [%eval 0,59] } 50...Rhxh6 { [%emt 0:00:47] [%eval 0,64] } 51.Rxb7+ { [%emt 0:00:22] [%eval 0,52] } 51...Rb6 { [%emt 0:00:40] [%eval 0,65] } 52.Rxb6+ { [%emt 0:00:25] [%eval 0,59] } 52...Rxb6 { [%emt 0:00:27] [%eval 0,63] } 53.Kg2 { [%emt 0:00:32] [%eval 0,60] } 53...Rd6 { [%emt 0:00:27] [%eval 0,61] } 54.Kf2 { [%emt 0:00:23] [%eval 0,60] } 54...Re6 { [%emt 0:00:26] [%eval 0,63] } 1/2-1/2
``````

Surprise black is able to draw.

• Interesting variation of the question. Commented May 26, 2022 at 17:53