A FEN string looks like this:
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
It contains 6 space-separated fields:
- Piece placement
- Active color
- Castling availability
- En passant target square
- Halfmove clock
- Fullmove number
This part represents the board layout, starting from rank 8 to rank 1 (top to bottom), with / separating ranks.
Pieces are represented by letters:
- Uppercase = White (
P,N,B,R,Q,K) - Lowercase = Black (
p,n,b,r,q,k) - Digits = number of empty squares
Example:
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR
This is the initial board setup.
Whose turn it is:
w= Whiteb= Black
- Letters indicate castling rights:
K= White kingsideQ= White queensidek= Black kingsideq= Black queenside
-if no castling is available
Example:
KQkq
Means both players can castle both ways.
If a pawn has just moved two squares forward, this shows the square behind it for en passant.
- Example:
e3(white just moved pawn frome2toe4, black can capture en passant one3) -means no en passant possible
Number of halfmoves since the last pawn move or capture. Used for the 50-move draw rule.
Starts at 1, and increments after Black's move.
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
- Position: Starting position
- White to move
- Both sides can castle both directions
- No en passant
- 0 halfmoves since capture/pawn move
- Move number 1