Check, checkmate & stalemate

Can you castle to get out of check?

Updated · Sergei Tovmasian

Short answer

No. Castling is the one king move you may not make while your king is in check. Answer the check another way (move the king, take the checking piece, or block the line) and the right to castle survives untouched, as long as the king itself stays put. You also may not castle through an attacked square or onto one.

1.e4 e5 2.Nf3 Nc6 3.Bc4 Bc5 4.c3 Nf6 5.d4 exd4 6.cxd4 Bb4+, and White would dearly love to tuck the king away. Look at the kingside: f1 and g1 are empty, the rook is on h1, and g1 is a square the bishop on b4 cannot reach. Short castling would answer the check perfectly. It is still illegal.

8
7
6
5
4
3
2
a
b
c
d
e
f
g
h 1
The Italian Game after 6...Bb4+. White has exactly seven legal moves: Nc3, Nbd2, Nfd2, Bd2, Qd2, Kf1 and Ke2. Castling is not among them.

The right is postponed, not lost

The Laws phrase it as castling being prevented temporarily, and the word doing the work is temporarily. Nothing is destroyed. Block the check or capture the piece giving it, and the king has not moved, the rook has not moved, and castling is back on the menu the moment the check is gone.

That is exactly what happens in the diagram. 7.Nc3 blocks on the b4-e1 diagonal, and after 7…Nxe4 White plays 8.O-O, two moves after being in check, straight into a main line of the Giuoco Piano that has been argued about for a hundred years.

What does cost you the castle permanently is answering with the king. 7.Kf1 is perfectly legal there, and it is why this rule bites so often: when the only other replies are awkward, a check can push you into a king move you did not want, and the rook on h1 sits out the rest of the game. Before you play the king move, look twice for a block.

The two other bans people mix up

Three squares have to be clean when you castle, and every one of them belongs to the king:

  • the square the king stands on (e1 or e8), which is the one this page is about
  • the square the king crosses (f1, d1, f8, d8)
  • the square the king lands on (g1, c1, g8, c8)

What is allowed, and surprises almost everyone: the rook can be attacked, and the rook can cross an attacked square. Castling queenside with an enemy bishop covering b1 is fine, because b1 is the rook’s business and the rule says nothing about the rook. The full set of conditions is on when you cannot castle, the crossing rule has its own page on castling through check, and the same ban seen from the castling side is on can you castle out of check.

At the board it can cost you more than the castle

Touch-move (Art. 4.3) makes you move a piece you deliberately touch, if that piece has a legal move. In the diagram your king has two, Kf1 and Ke2. So if you reach for the king meaning to castle, remember halfway that you cannot, and pull your hand back, you have already committed yourself to one of those two, and the arbiter will hold you to it. Reach for the rook first and you can lose the castle on that side altogether, which is why the king always moves first.

None of this is theory you memorise. Play through fifty castling puzzles and the illegal ones stop occurring to you.

More questions

Do you lose the right to castle if you are checked?

No. Being in check only stops you castling on that move. If you answer the check by blocking it or capturing the checking piece, your king and rook have not moved, so you may castle later in the game. You lose the right for good only by moving the king, or the rook on that side.

Can you castle if the rook is attacked?

Yes. The three squares that must be safe are the king's square, the square the king crosses and the square it lands on. The rook is not covered by the rule, so it may be attacked, and when you castle queenside it may cross b1 or b8 while an enemy piece is watching that square.

What if castling is the only way to stop the check?

Then it is not available and you find something else, or you are checkmated. Castling is not a legal reply to a check under any circumstances, and if the position offers no other answer, the check is mate. The rule has no exception for the king reaching a safe square.

Go deeper

Spot checkmate faster. The app serves mate-in-one and mate-in-two at your rating.

← All: Check, checkmate & stalemate · Learn chess