Your king is in check, your rook is still on h1, and castling looks like the perfect escape. Is it legal? And what about castling through check, or castling once the check is gone?
No, you can’t castle out of check. Under the standard rules, castling is illegal while your king is in check. But once the king is out of check, you can castle again, as long as every other castling rule is met.
New to castling? This short video by Chess.com shows you what castling is and how to do it.
Rules Of Castling
The rules of castling trip up a lot of new players. The good news? There are only 4 of them, and once you know them, you won’t get caught out.
According to the FIDE Laws Of Chess, you can’t castle:
- If your king is in check
- If the square the king passes over, or the square it lands on, is under attack
- If the king or that rook has already moved
- If there is any piece between the king and the rook
These are known as the 4 rules of castling. Notice that 2 of them are about check.
Knowing when you can castle is half the battle. Knowing when you should is the other half. To learn that, read our guide to when you should castle, when not to, whether to castle early, and the perfect time to castle.
What if it’s your rook that’s attacked, not your king? Can you castle when your rook is threatened? Yes. Nothing in the FIDE Laws Of Chess stops you.
That guide also shows 2 professional games where this happened, and it answers more castling questions you might have.
Example To Explain Castling Under Check
Here’s one position that shows all 3 check rules at once. Look at the diagram and see if you can spot why White can’t castle. Then check each case below.

Case-1: Castling Through Check
To castle kingside, White’s king goes from e1 to g1. On the way, it passes over f1. But Black’s bishop on h3 controls f1.
So can you castle through check? No. The king can’t cross a square that’s under attack, so castling through check is illegal.
Case-2: Castling Into Check
Now look at where the king would land. After castling, White’s king sits on g1. But Black’s rook on g3 already controls g1.
So can you castle into check? No. You can never make a move that puts your own king in check, and castling is no exception.
To learn more, read our guide to Can You Put Yourself In Check? (Here’s What Happens!)
Case-3: Castling Out Of Check
Finally, the king itself. Even before you look at f1 and g1, White can’t castle here. Black’s queen on e3 is already giving check.
Castling is illegal while your king is in check. So you can’t use it to get out of check. You have to deal with the check another way.
Can you capture the checking piece instead? Read our guide to Can You Kill To Get Out Of Check? (Explained)
Tip: these rules apply to both sides of the board. To see how the 2 kinds of castling differ, read our guide to kingside and queenside castling.
Why Can’t You Castle Out Of Check?
You can’t castle out of check because it would make checks far too easy to escape. Every chess rule keeps the game in balance, and even a small change can ripple through everything.
Picture it from the attacker’s side. You’ve built a strong attack, you give check, and the win looks close.
Then your opponent simply castles away from the danger. Your whole attack goes up in smoke with one move. The rule stops that from happening.
Other rules have the same job. Stalemate, for example, exists to keep the game in balance too.
In A Nutshell
You can’t castle through check, into check or out of check.
- You can’t castle to get out of check. The rules don’t allow it.
- You can castle when your rook is under attack. No rule stops you.
- The rule exists because castling out of check would upset the balance of the game.
Want the full picture? Read our guide to When Can You Castle In Chess?
Related Questions:
Can you castle after being in check?
You can castle after being in check, but not while you’re in check. Castling is blocked as long as an enemy piece attacks your king’s square. Once the king is out of check, you can castle again.
Can you castle if the king is unmoved but checked?
No, you can’t castle if the king is unmoved but checked. An unmoved king is only one condition. The king also must not be in check.
Can you castle out of checkmate?
No, you can’t castle out of checkmate. The game ends the moment your king is checkmated, so there’s no move left to make.
Can you castle queenside?
Yes, you can castle queenside as well as kingside. Your king can’t be in check, and castling can’t put it in check. The king and that rook must not have moved, and no piece can stand between them.
Why can you not castle in chess?
You can’t castle in chess if your king is in check or castling would put it in check. You also can’t castle if the king or rook has moved, or a piece stands between them.
Wondering about technique too? Read Is Castling with two hands illegal?
Conclusion
Next time you’re in check, forget about castling for that move. Deal with the check first. Then, if every castling rule is met, you can castle on a later move.
Want to keep improving? See our chess recommendations page.




