Answers.Body: <p>Yes, this part of the FEN is (<strong>only</strong>!) about whether either of the rooks (or the king!) <em><strong><strong>have moved earlier</strong></strong></em>, in which case the respective rights disappear (K <em>and</em> Q resp. k <em>and</em> q, if the king moved).</p>
  <p>It is <strong>not</strong> 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 <em><strong><strong>any of the squares it travels over</strong></strong></em> 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 &quot;detail&quot;, 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.)</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-12-16T03:38:06.647Z
Answers.LastActivityDate: 2021-12-16T03:38:06.647Z
Answers.UserDisplayName: Max
Answers.Body: <p>If one of the rooks has moved from its starting position, it is no longer legal to castle with that rook.</p>
  
  <p>For example, if white plays <code>1. a4 2. Ra3 3. Ra1</code>, white can no longer castle long, even though the king and rook are both in their normal positions.</p>
  
  <p>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).</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-12-16T16:00:38.060Z
Answers.Text: 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.
Answers.UserDisplayName: phs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2013-02-16T03:57:49.503Z
Answers.Text: Thank you.  I figured there was just some small technicality I was forgetting.
Answers.UserDisplayName: SL2
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2013-02-16T03:22:52.777Z
Answers.LastActivityDate: 2013-02-16T03:22:52.777Z
Answers.UserDisplayName: Andrew
Body: <p>I was reading about FEN notation, and noticed the following line in <a href="http://en.wikipedia.org/wiki/Forsyth%E2%80%93Edwards_Notation">the relevant Wikipedia article</a>:</p>
  
  <blockquote>
    <p>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).</p>
  </blockquote>
  
  <p>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.</p>
  
Tags: <castling><fen>
Title: Question on FEN and castling
ThreadText: # Question on FEN and castling
  
  (Asked by: username_0 on 2013-02-16)
  
  I was reading about FEN notation, and noticed the following line in [the relevant Wikipedia article](http://en.wikipedia.org/wiki/Forsyth%E2%80%93Edwards_Notation):
  
  > 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.
  
  **Tags:** castling, fen
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2013-02-16. Score: 13 | Accepted answer
  
  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).
  
  > **Comments:**
  > **username_0**: Thank you.  I figured there was just some small technicality I was forgetting.  
  > **username_3**: 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.  
  
  ---
  
  ### Answer by username_1 on 2021-12-16. Score: 0
  
  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.)
  
  
  ---
  
  