Chess rules

Why can't I castle?

You can castle only if your king and that rook have never moved, nothing stands between them, your king is not in check, and the king does not cross or land on a square the opponent attacks.

The rule

  1. 1Neither your king nor that rook has moved yet in the game.
  2. 2Every square between the king and the rook is empty.
  3. 3Your king is not in check right now.
  4. 4The king does not pass through, or land on, a square attacked by an enemy piece.

See it on the board

Everything is in place: White can castle on either side.
Everything is in place: White can castle on either side.
The same pieces, but earlier in the game White's king stepped to f1 and back. It looks identical, yet White can no longer castle on either side.
The same pieces, but earlier in the game White's king stepped to f1 and back. It looks identical, yet White can no longer castle on either side.
The knight on b1 is in the way. Every square between king and rook must be empty, so no queenside castling until it moves.
The knight on b1 is in the way. Every square between king and rook must be empty, so no queenside castling until it moves.
The bishop on c4 attacks f1, the square the king would pass through. You cannot castle through check.
The bishop on c4 attacks f1, the square the king would pass through. You cannot castle through check.
The rook on g2 attacks g1, where the king would land. You cannot castle into check either.
The rook on g2 attacks g1, where the king would land. You cannot castle into check either.
The king is in check from the rook on a1, so castling is not allowed until the check is dealt with.
The king is in check from the rook on a1, so castling is not allowed until the check is dealt with.
The trick question: the black rook attacks b1, but only the king's squares matter. Queenside castling is legal.
The trick question: the black rook attacks b1, but only the king's squares matter. Queenside castling is legal.

Questions

Can you castle out of check?

No. If your king is in check, castling is not one of the ways out: block, capture the checking piece, or move the king normally. Once the check is over you may castle later, as long as the king itself never moved.

Can you castle after being in check?

Yes. Being checked earlier in the game does not cost you castling. Only moving the king does. If you got out of check by blocking or capturing, castling is still available.

Can you castle through check or into check?

No to both. The king may not pass over a square an enemy piece attacks, and it may not land on one. For kingside castling that means f1 and g1 (f8 and g8 for Black); for queenside, d1 and c1 (d8 and c8).

Can I castle if my king moved and came back?

No. Once the king has moved, even if it returns to its starting square, castling is gone for the rest of the game, on both sides. If only one rook has moved, you can still castle with the other one.

Can I castle when my rook is attacked?

Yes. The rule is only about the king: it must not be in check, and it must not cross or land on an attacked square. The rook may be attacked, and on the queenside the rook may even pass through an attacked square.

How do I castle on a chess site?

Move the king two squares towards the rook and the rook jumps over on its own; many sites also let you drop the king onto the rook. If the site will not let you castle, one of the four conditions above is not met.

Can you castle twice, or with the queen?

No. Each player castles at most once a game, because the king has moved afterwards. And castling is only ever king and rook: never the queen, bishop or knight, and never a rook that was promoted from a pawn.

Next step

Lesson · 6 minChess opening rules for beginnersCastling is one of the five opening rules: get your king safe early, then everything else.

Source: FIDE Laws of Chess (effective 1 January 2023), Article 3.8.2. Every diagram on this page is checked against the rules by code: how we check.