You cannot castle through check. Learn which squares the king must avoid, why the rule exists, and how to tell when castling is legal.
Can you castle if your rook is under attack? Yes, you can โ an attacked rook doesn’t automatically prevent castling. What actually matters is whether the king is in a position that satisfies the castling conditions; an opponent merely attacking your rook doesn’t, by itself, change that. Why the Rook Being Attacked Doesn’t Stop Castling…