user32028: 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.

user30545: 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.
Engine threads: 2
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.

user30563: 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:

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.
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.

user32155: 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!

user3757: 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.

32028: <p>I saw this question:  <a href="https://chess.stackexchange.com/q/24245/32028">How often does castling occur in grandmaster games?</a><br> The statistics are interesting. The answer states that they do so about 90% of their games.</p>
<p>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?</p>
<p>(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.)</p>
<p>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.</p>
<p><strong>EDIT</strong>: Sorry if this causes too much discussion of refining my question.  I certainly am inviting someone to <em><strong>do</strong></em> such a statistical analysis, looking for correlations.  But I was mainly asking if someone had <em>already done</em> any such thing -- asking: &quot;Do you know of a paper/article treatment of it?&quot;  (Mind you, not one that just gives advice, but one that calculated some statistics from a game database.)</p>
<p>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.</p>
 30545: <p>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.</p>
<h3>White cannot castle but black can</h3>
<p>FEN: <code>rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w kq - 0 1</code><br />
Time control: 1hr + 30s inc.<br />
Engine threads: 2<br />
Hash mb: 512<br />
Condition: Black can castle, white cannot</p>
<pre><code>[Event &quot;Engine match&quot;]
[Site &quot;?&quot;]
[Date &quot;2022.05.25&quot;]
[Round &quot;1&quot;]
[White &quot;Stockfish 15&quot;]
[Black &quot;Stockfish 15&quot;]
[Result &quot;1/2-1/2&quot;]
[FEN &quot;rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w kq - 0 1&quot;]
[SetUp &quot;1&quot;]
[TimeControl &quot;3600+30&quot;]

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
</code></pre>
<p>Black has the advantage for sure, but could not win it.</p>
<h3>White can castle but black cannot</h3>
<p>FEN: <code>rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQ - 0 1</code></p>
<pre><code>[Event &quot;Engine match&quot;]
[Site &quot;?&quot;]
[Date &quot;2022.05.25&quot;]
[Round &quot;1&quot;]
[White &quot;Stockfish 15&quot;]
[Black &quot;Stockfish 15&quot;]
[Result &quot;1/2-1/2&quot;]
[FEN &quot;rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQ - 0 1&quot;]
[SetUp &quot;1&quot;]
[TimeControl &quot;3600+30&quot;]

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
</code></pre>
<p>Surprise black is able to draw.</p>
 30563: <p>Your question will by its definition generate useless data, whilest your intent is very useful.</p>
<p>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).</p>
<p>These 'insights' will lack nuances since:</p>
<ol>
<li>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.</li>
<li>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.</li>
</ol>
<p>Also note that castling just for the sake of castling (or because the opponent does it) is not the best motive to do it.</p>
<p>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.</p>
<p>In short: <strong>there is a clear correlation to not castling and losing.</strong></p>
<p>Maybe all those chess teachers and GMs are right after all? :-)</p>
<p><em>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.</em></p>
 32155: <p>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.</p>
<hr />
<p>Some online chess websites have the option to get insights from your game(s).</p>
<p><a href="https://www.chess.com" rel="nofollow noreferrer"><strong>Chess.com</strong></a> has a paid feature which you can take a look at by going to <a href="https://www.chess.com/insights/hikaru#castling" rel="nofollow noreferrer">Chess Insights</a>.</p>
<p>Here are the insights from GM Hikaru Nakamura's games
<a href="https://i.stack.imgur.com/eJlYQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eJlYQ.png" alt="" /></a></p>
<p><a href="https://www.lichess.org" rel="nofollow noreferrer"><strong>Lichess</strong></a> provides you with a similar Insights feature at no cost. You can check it out by going <a href="https://lichess.org/insights/howdymodi/result/myCastling" rel="nofollow noreferrer">here</a>.</p>
<p>Here are some insights from my games:
<a href="https://i.stack.imgur.com/Rnsn2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Rnsn2.png" alt="enter image description here" /></a></p>
<p>As you can see the rate of losing the game is slightly higher when you <em>Don't castle</em>!</p>
 3757: <p>I calculated some statistics on games published by <a href="https://theweekinchess.com/twic" rel="nofollow noreferrer">TWIC</a> (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.</p>
<h1>Castling <em>vs.</em> not castling</h1>
<p>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.</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th></th>
<th style="text-align: center;">White</th>
<th style="text-align: center;">Black</th>
</tr>
</thead>
<tbody>
<tr>
<td>Castling</td>
<td style="text-align: center;">0.540</td>
<td style="text-align: center;">0.468</td>
</tr>
<tr>
<td>Not castling</td>
<td style="text-align: center;">0.518</td>
<td style="text-align: center;">0.424</td>
</tr>
</tbody>
</table>
</div>
<p>So, yes, not castling is associated with having a worse score in average (no surprise here). Now, this can mean several things:</p>
<ul>
<li>Not castling is detrimental for your play (in general).</li>
<li>The better player doesn't let the other one castle, and profits from this.</li>
<li>The not-castling player loses before even being able to castle.</li>
</ul>
<h1>Castling long <em>vs.</em> Castling short</h1>
<p>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.)</p>
<div class="s-table-container">
<table class="s-table">
<thead>
<tr>
<th style="text-align: center;"></th>
<th style="text-align: center;">% White Wins</th>
<th style="text-align: center;">% White Draws</th>
<th style="text-align: center;">White score</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align: center;">O-O / O-O</td>
<td style="text-align: center;">39.4</td>
<td style="text-align: center;">27.8</td>
<td style="text-align: center;">0.533</td>
</tr>
<tr>
<td style="text-align: center;">O-O / O-O-O</td>
<td style="text-align: center;">43.1</td>
<td style="text-align: center;">19.9</td>
<td style="text-align: center;">0.530</td>
</tr>
<tr>
<td style="text-align: center;">O-O-O / O-O</td>
<td style="text-align: center;">44.5</td>
<td style="text-align: center;">19.9</td>
<td style="text-align: center;">0.545</td>
</tr>
<tr>
<td style="text-align: center;">O-O-O / O-O-O</td>
<td style="text-align: center;">41.8</td>
<td style="text-align: center;">26.4</td>
<td style="text-align: center;">0.551</td>
</tr>
</tbody>
</table>
</div>
<p>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.</p>
<p>The data indicates also that white's score is highest when both players castle long.</p>
<h1>The time of castling</h1>
<p>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.</p>
<p><a href="https://i.stack.imgur.com/eLECX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eLECX.png" alt="enter image description here" /></a></p>
<p>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.</p>
<p>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...</p>
<h1>Methodological notes</h1>
<p>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.</p>
