How to read a FEN
Forsyth–Edwards Notation writes an entire position — including the things you cannot see on a board — as one line of text. Six fields, separated by spaces.
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
The six fields
- Placement
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR - Eight ranks separated by slashes, written from Black's back rank down to White's. Uppercase is White, lowercase Black. A digit means that many empty squares in a row, so 8 is an empty rank and 3p4 is three empty squares, a black pawn, then four more.
- Side to move
w - w or b. This is the field people most often get wrong when typing a position by hand, and it inverts the entire evaluation when they do.
- Castling
KQkq - Which castles are still legal in principle: K and Q for White's kingside and queenside, k and q for Black's. A dash means none remain. It records rights, not whether castling is legal right now.
- En passant
- - The square a pawn just skipped over, written as the square behind it — so a pawn going e2–e4 sets this to e3. It is set only on the move immediately after a double step, and is a dash the rest of the time.
- Halfmove clock
0 - Moves since the last capture or pawn move. At 100 — fifty moves by each side — a draw can be claimed. This is the field engines need in order to see a fifty-move draw coming.
- Fullmove number
1 - Starts at 1 and increases after Black moves. Cosmetic for analysis: it changes how a line is numbered, not what the engine plays.
Why the last four fields matter
It is tempting to treat everything after the placement as bookkeeping. It is not. Here is the same board with Black having just played f7–f5:
rnbqkbnr/ppp1p1pp/8/3pPp2/8/8/PPPP1PPP/RNBQKBNR w KQkq f6 0 3
The f6 in the fifth field is what makes exf6 legal. Drop it and write - instead, and the position looks identical on the board while a perfectly good capture disappears — and with it, in some positions, the entire evaluation. The same is true of castling rights: strip KQkq to - and a king that could have run to safety is stuck in the centre.
What usually goes wrong
- The ranks are upside down. A FEN starts at Black’s back rank. Writing it from White’s gives a legal-looking string describing a different position entirely.
- The digits do not add to eight. Every rank must account for exactly eight squares.
rnbqkbnris eight pieces;4p3is four empties, a pawn, three empties. - The side to move is left at
w. If it is really Black’s turn, the engine answers a question you did not ask. - Castling rights are kept after the king has moved. Most tools tolerate this, but the engine will consider a castle that cannot happen.
Test one
Paste any FEN into the analysis board. It rejects strings that are not legal positions, which makes it a quick way to check whether the one you have is well formed before you rely on it.