← StudyX Devlog

Can You Castle Out of Check? Common Castling Questions

Hiroki ObaraHiroki Obara · DeveloperChess365How-To
Can You Castle Out of Check? Common Castling Questions

No, you cannot castle out of check. A king in check has to answer the check in one of the usual ways: the king moves, the checking piece is captured, or a piece is put in between.

The rule is Article 3.8.2 of the FIDE Laws of Chess, the version in force since 1 January 2023. This article takes the common castling questions one at a time and checks each against the text, with a small position. How castling is played and what it is for are in Castling Rules.

What the Laws say about castling

Article 3.8.2 describes castling as “a move of the king and either rook of the same colour along the player’s first rank, counting as a single move of the king”. The king is transferred from its original square two squares towards the rook, “then that rook is transferred to the square the king has just crossed.”

The cases where castling is not possible are split into two articles.

  • Article 3.8.2.1. “The right to castle has been lost: 1) If the king has already moved, or 2) With a rook that has already moved.”
  • Article 3.8.2.2. “Castling is prevented temporarily: 3) If the square on which the king stands, or the square which it must cross, or the square which it is to occupy, is attacked by one or more of the opponent’s pieces, or 4) If there is any piece between the king and the rook with which castling is to be effected.”

The numbers 1) to 4) are the ones printed in the Laws. Every question below is settled by these four items.

Can you castle out of check?

No. Article 3.9.1 says the king is “in check” if it is attacked by one or more of the opponent’s pieces. A king in check is the first case of item 3): the square on which the king stands is attacked.

Position 1: White king on e1, white rook on h1. Black king on g8, black rook on e8. White to move.

The rook on e8 gives check along the e-file. Neither the king nor the rook has moved and nothing stands between them, but White cannot castle. White has four legal moves, all with the king: to d1, d2, f1 or f2.

Each of the four is a king move, so playing it brings item 1) into effect and the right to castle is lost. The three ways to answer a check are set out in Check vs Checkmate.

Can you castle through check?

No. Item 3) also names the square the king must cross. For White that is f1 on the kingside and d1 on the queenside. For Black it is f8 and d8.

Position 2: White king on e1, white rook on h1. Black king on g8, black rook on f8. White to move.

The white king is not in check, and g1, the square it would occupy, is not attacked. The rook on f8 attacks f1 along the f-file, so White cannot castle.

The article says “temporarily”. If the black rook leaves the f-file, or a piece comes between it and f1, castling is possible again.

Can you castle into check?

No. This is the third case of item 3), the square the king is to occupy: g1 on the kingside, c1 on the queenside.

Position 3: White king on e1, white rook on h1. Black king on b8, black rook on g8. White to move.

The rook on g8 attacks g1. Castling would put the white king on an attacked square, so White cannot castle.

This is not special to castling. Article 3.9.2 says that no piece can be moved that will expose the king of the same colour to check. King moves in general are covered in Can a King Capture a Queen?.

Can you castle when the rook is attacked?

Yes. Item 3) lists three squares: where the king stands, the square it must cross and the square it is to occupy. The rook’s square is not one of them.

Position 4: White king on e1, white rook on h1. Black king on b8, black rook on h8. White to move.

The rook on h8 attacks the rook on h1 along the h-file. No black piece attacks e1, f1 or g1. White can castle. After castling the king stands on g1 and the rook on f1.

Can the rook pass an attacked square (b1 and b8)?

Yes. In queenside castling the king goes from e1 across d1 to c1. The rook goes from a1 through b1 and c1 to d1. Only the rook passes b1, and b1 is not one of the three squares in item 3). For Black the square is b8.

Position 5: White king on e1, white rook on a1. Black king on g8, black rook on b8. White to move.

The rook on b8 attacks b1. No black piece attacks e1, d1 or c1. White can castle queenside.

With the black rook on c8 instead of b8, the square the king is to occupy, c1, is attacked, and White cannot castle. With the rook on d8, the square the king must cross, d1, is attacked, and again White cannot castle.

What b1 does need is to be empty. Item 4) covers any piece between the king and the rook, and b1 lies between them.

Can you castle after the king or the rook has moved?

After the king has moved, there is no castling on either side. After a rook has moved, there is no castling with that rook. The heading of Article 3.8.2.1 says the right “has been lost”. It is not a temporary case, so the right does not come back when the piece returns to its original square.

Position 6: White king on e1, white rooks on a1 and h1. Black king on g8. White to move. Neither the king nor the rooks have moved.

Here White can castle on either side. Two lines from this position show the difference.

  • White plays the rook from h1 to h2, Black plays the king to g7, White plays the rook back to h1 and Black plays the king back to g8. The pieces stand where they started, but White cannot castle kingside. The rook on a1 has not moved, so White can still castle queenside
  • White plays the king to e2, Black plays the king to g7, White plays the king back to e1 and Black plays the king back to g8. The pieces stand where they started, but White cannot castle on either side

Can you castle after you have been in check?

Yes, as long as the king has not moved. Article 3.8.2.1 names two ways to lose the right: the king has moved, or the rook has moved. Having been in check is not among them. Check belongs to the temporary cases of Article 3.8.2.2, and once the check is answered that condition is gone.

Position 7: White king on e1, white rook on h1, white bishop on d3. Black king on g8, black rook on a8. Black to move.

Black moves the rook to e8, and the white king is in check. White moves the bishop to e2, between the king and the rook. Black moves the king to g7.

At this point the white king has been in check once, but it has not moved. No black piece attacks e1, f1 or g1, and White can castle.

Answering the check with the king is a different matter. If White had moved the king to f1 instead of the bishop to e2, the king would have moved, and the right to castle would be lost.

Which piece do you touch first, the king or the rook?

In a game played with a board and pieces, a player who touches the rook first cannot castle on that move. Article 4.4 has the items for castling. It applies to a player having the move who:

  • “touches his/her king and a rook” (4.4.1). The player “must castle on that side if it is legal to do so”
  • “deliberately touches a rook and then his/her king” (4.4.2). The player “is not allowed to castle on that side on that move”, and the situation is governed by Article 4.3.1. The rook was touched first, so if it can be moved, it is the piece that must move
  • “intending to castle, touches the king and then a rook, but castling with this rook is illegal” (4.4.3). The player “must make another legal move with his/her king (which may include castling with the other rook)”

Article 3.8.2 describes the move in the same order: the king is transferred two squares, then the rook. The touch rules as a whole are in The Touch-Move Rule in Chess.

Sources

  • FIDE, “Laws of Chess”

Practising with Chess365

Chess365 is a checkmate puzzle app with 1,000 puzzles each of mate in 2, 3, 4 and 5. You always play White, you can make any legal move, and Black replies automatically. If the line ends without mate, the app tells you the king got away and you start again from the beginning. If you stalemate Black, the app shows a separate message explaining that it is a draw.

A hint lights up the piece to move and its destination, and you play the move yourself. After solving, “Review moves” lets you step back and forward through the moves to check the line.

All the puzzles are free, and a one-time “Remove Ads” purchase removes the ads. How to start with mate puzzles is in Chess checkmate puzzles for beginners, and how to use the app is in Getting Started with Chess365.

Download on the App Store Get it on Google Play

Chess365A chess mate puzzle every day