Can You Castle Out Of Check?

Castling is one of the weirdest moves in chess. It’s the only time you can move two pieces at once, the king can move two moves, and the rook can jump over a piece.

So it’s no wonder a lot of new players are wondering how to castle and when you are allowed to castle.

You are not allowed to castle if your king is currently in check, even if this would bring your king to safety. However, you can still castle on a later move as long as you didn’t move the king.

Let’s take a closer look at the castling rules and when you can castle to answer any other questions you might still have.

What are the 4 rules of castling?

You aren’t allowed to castle in every position. You’ll have to fulfill the following four conditions if you want to castle.

1. Both the king and rook have not moved yet

You can only castle if both the king and the rook you want to castle with have not moved since the beginning of the game.

If you moved the king, you can no longer castle short or long. And if you have moved one of your rooks, you can no longer castle on that side of the board.

However, if you have only moved one of the rooks, you can still castle with the other rook.

In the position below, white has the option of castling either kingside or queenside, since the king and the rooks haven’t moved yet. However, black can only castle kingside, because he has moved his queenside rook to b8.

2. There are no pieces between the king and rook

You can only castle if there are no pieces between the king and rook. If you want to castle kingside, the f1 and g1 squares need to be empty. And if you want to castle queenside, the b1, c1 and d1 squares need to be empty.

In the position below, white can only castle kingside because the knight on b1 prevents white from castling queenside. Black can also only castle kingside, because he already moved his a8 rook to d8.

3. The king is not currently in check

You can not castle if your king is in check, regardless of which of the opponent’s pieces is giving the check. You first have to block the check or capture the piece that is giving the check. After dealing with the check, you can still castle on one of your future moves.

In the diagram below it is black’s turn to move. Black isn’t allowed to castle kingside, because the bishop on b5 is giving check. However, black can block the check by playing his own c8 bishop to d7 on this turn, and try to castle on the next move.

4. The two squares the king needs to move are not under attack

When castling, your king moves two squares horizontally and the rook jumps over. However, if one of the two square that the king moves is under attack, you are not allowed to castle.

The reason for this is that you would move your king into a check or through a check during the castling move.

In this position, white is not allowed to castle either kingside or queenside. Black’s bishop on a6 keeps an eye on the f1 square, which prevents white from castling kingside. And the bishop on a3 is attacking the c1 square, which prevents white from castling queenside.

However, if it was black’s move, he would be able to castle kingside, but not queenside due to white’s knight attacking the c8 square.

Why is castling out of check illegal?

So by now you probably understand that castling out of a check is illegal because it violates the third castling rule. You can only castle if your king is currently safe, is safe while castling, and will be safe on the final square after castling.

Can you castle through a check?

Although castling through a check and castling out of a check are slightly different, you are also not allowed to castle through a check.

In the first diagram below, the black king is currently in check by the white bishop on b5. So the black king isn’t allowed to castle out of check by castling kingside.

In this second position, the white king is currently not in check. However, the white king can’t castle on the kingside. When castling kingside, the white king would have to move two squares via f1 to g1.

Since the black bishop on a6 is attacking the f1 square, this would be considered castling through a check. So this would not be allowed, even though the white king would be safe on the final g1 square.

Can you castle into a check?

You are never allowed to move your king to a square on which it would be attacked by one of the opponent’s pieces. Since this also includes castling, you are not allowed to castle into a check either.

If we look at the position below one more time, you can see that neither the white king nor the black king are allowed to castle queenside, because this would place their own king in a check.

The black bishop on a3 is attacking the c1 square, and the white knight on b6 is attacking the c8 square.

Can you castle after being in check?

Yes, although you can’t castle out of a check, you can still castle on a later move after you have dealt with the check. There are three ways to deal with a check: moving the king, blocking the check, and capturing the checking piece.

However, if you want to castle after a check, you still need to follow the same 4 castling rules. Which means can’t move your king or capture the checking piece with your king when dealing with the check.

Can you castle if your rook is attacked?

Yes! You can’t castle out of a check. But if only your rook is attacked and you still fulfill all the castling conditions, then you can castle to bring your rook to safety.

Below you can see an example of this. The white rook on h1 is currently under attack by the black bishop on c6. But since white fulfills the 4 castling rules, white is still allowed to castle kingside in the current position.

Conclusion

According to the castling rules, you are not allowed to castle out of check, through a check, or into a check. All of these moves are considered to be illegal. However, after dealing with the check, you can still castle on a later move. And you can also castle if only your rook is attacked.