# Question on FEN and castling

I was reading about FEN notation, and noticed the following line in the relevant Wikipedia article:

If neither side can castle, this is "-". Otherwise, this has one or more letters: "K" (White can castle kingside), "Q" (White can castle queenside), "k" (Black can castle kingside), and/or "q" (Black can castle queenside).

Why do we need to mark the ability to castle each side separately? I can't imagine a circumstance where one would be able to castle kingside, but not queenside unless the reason you can't do one is because it would be illegal to castle in one of the directions. But if this is the only reason, why would this need to be documented when recording a game in FEN? Maybe there is something about castling I'm misunderstanding.

If one of the rooks has moved from its starting position, it is no longer legal to castle with that rook.

For example, if white plays `1. a4 2. Ra3 3. Ra1`, white can no longer castle long, even though the king and rook are both in their normal positions.

For this reason, the FEN string must encode whether or not castling is legal (because both king and rook can be on the proper squares, but castling can still be illegal).

• Thank you. I figured there was just some small technicality I was forgetting.
– SL2
Feb 16, 2013 at 3:57
• A bit of motivation: In most positions arising from actual games it is pretty clear who can castle and this is usually not an issue. But the FEN notation is also used in situations where this is not clear at all. First it is used in chess problems, where the positions are artificial, and where the whole point of the problem might be to determine castling rights. Also it is used by computer programs where relying on naive assumptions brings bugs with unforeseenable consequences. Risks are compounded when the FEN notation is used by programs for chess problems.
– phs
Dec 16, 2021 at 16:00

Yes, this part of the FEN is (only!) about whether either of the rooks (or the king!) have moved earlier, in which case the respective rights disappear (K and Q resp. k and q, if the king moved).

It is not about whether it is legal or not to castle in one or the other direction because of threatened squares. (Note that castling is not only forbidden when the king is in check, but also when any of the squares it travels over is threatened. This can and usually does also vary between kingside and queenside castling right considerations -- which makes me think that you may have forgotten about that "detail", too. For example, if the square f1 or g1 is threatened by an opponent's piece, then you can't castle kingside, but you may well be allowed to castle queenside.)