A FEN string has six space-separated fields: piece placement by rank, side to move, castling rights, the en passant target square, the halfmove clock, and the fullmove number. The first field is the only one that describes the board; the other five describe the state of the game around it.
Most FEN problems come down to one field. This page walks through all six with worked examples, so you can spot which part of a string is wrong rather than guessing.
r3k2r/pppq1ppp/2npbn2/4p3/4P3/2NPBN2/PPPQ1PPP/R3K2R w KQkq - 0 1Field 1: piece placement
Eight ranks, separated by slashes, from rank 8 down to rank 1. Each rank is written left to right, file a to file h.
| Character | Means |
|---|---|
| K / k | King, White / Black |
| Q / q | Queen |
| R / r | Rook |
| B / b | Bishop |
| N / n | Knight |
| P / p | Pawn |
| 1 to 8 | That many consecutive empty squares |
Read r3k2r as eight squares: rook, then three empty, then the king, then two empty, then a rook. That is a back rank with both rooks still home and the queen and bishops gone, which is why the position above has castling rights for both sides despite being a middlegame.
Field 2: active colour
w or b. Nothing else is accepted. A surprisingly common bug is writing W or leaving the field blank, both of which produce a string that looks plausible and fails to load.
Field 3: castling availability
List the available castling moves in the order KQkq, dropping the ones that are gone. If none remain, write a single dash.
| Value | Meaning |
|---|---|
| KQkq | All four castling moves still available |
| Kq | White kingside and Black queenside only |
| - | No castling possible for either side |
Rights are independent of where the pieces happen to be. If a rook has moved away and come back, the position looks normal but the right is gone, and only this field records that fact.
Field 4: en passant target square
After a two-square pawn advance, this field names the square the pawn skipped over. After 1. e4 it is e3. If the previous move was anything other than a two-square pawn push, it is a dash.
rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1Field 5: halfmove clock
The number of plies since the last capture or pawn move. It exists for the fifty-move rule, which lets a player claim a draw once the count reaches 100 plies, that is fifty moves by each side.
- A capture resets it to 0.
- Any pawn move resets it to 0, including a non-capturing push.
- A quiet knight move, for example, increments it by one.
Field 6: fullmove number
Starts at 1 and increases after Black's move. It counts full moves, not plies, so after 1. e4 the number is still 1, and after 1... e5 it becomes 2.
Checking a FEN by hand
- Split the string on spaces and confirm you have six fields.
- Count the slashes: there must be exactly seven, giving eight ranks.
- For each rank, add the digits to the letters and check the total is 8.
- Confirm field 2 is exactly w or b.
- Confirm field 3 is a subset of KQkq in that order, or a dash.
- Confirm field 4 is a valid square on rank 3 or 6, or a dash.