Skip to content
Aback Chess
Sponsors

What is FEN? Chess positions as text

FEN is a single line of text that describes a complete chess position. Learn what each field means and how to build or read a FEN string.

Notation and formats · 5 min read · 1098 words · updated

FEN (Forsyth-Edwards Notation) is a single line of text that describes a complete chess position: where every piece stands, whose turn it is, castling rights, en passant, and the move clocks. A standard game starts at a FEN that begins rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1.

A chess position is a picture. FEN is that picture written down as text, in a form a computer or a player can paste into any chess program. Every analysis tool, database and engine speaks it, which is why it is worth knowing how to read.

FEN stands for Forsyth-Edwards Notation, named after the journalists who devised its ancestor for recording games in print. The version chess software uses today was standardised alongside the Portable Game Notation format, and it is the position half of the pair: PGN records a game, FEN records a single moment in it.

A FEN in one line

The starting position of every chess game is written like this:

rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
The standard starting position as FEN.

Six fields, separated by single spaces. Read left to right, they describe the board, then the state of the game around it.

FieldExampleMeaning
1rnbqkbnr/...Piece placement, from rank 8 down to rank 1
2wSide to move: w for White, b for Black
3KQkqCastling rights still available
4-En passant target square, or - if none
50Halfmove clock, for the fifty-move rule
61Fullmove number

Field 1: where the pieces are

The first field lists eight ranks separated by forward slashes, starting at rank 8 at the top and ending at rank 1 at the bottom. Within a rank, pieces are written as letters and empty squares as digits.

  • Uppercase letters are White pieces: K king, Q queen, R rook, B bishop, N knight, P pawn.
  • Lowercase letters are Black pieces: k, q, r, b, n, p.
  • A digit is a run of that many empty squares. So 8 means an entirely empty rank.
  • Ranks are always eight squares wide, so the digits in a rank must add up to 8.

Take the middle of the starting position: 8/8 means ranks 6 and 5 are empty. Now a real position from the Ruy Lopez:

r1bqkbnr/pppp1ppp/2n5/4p3/4P3/5N2/PPPP1PPP/RNBQKB1R b KQkq - 2 3
After 1. e4 e5 2. Nf3 Nc6, with Black to move. r1bqkbnr reads: rook, empty square, bishop, queen, king, bishop, knight, rook.

Field 2: whose turn it is

A single letter, w or b. This field matters more than it looks. The same arrangement of pieces can be strongly winning for one side to move and losing for the other, particularly in endgames with a lone rook or queen, so a FEN without the correct side to move is not the same position.

Field 3: castling rights

Four characters at most, in the order KQkq, listing which castling moves are still legal. K means White may still castle kingside, Q White queenside, k and q the same for Black. A dash means no castling is available for either side.

Field 4: en passant

If the previous move was a two-square pawn advance that could be captured en passant, this field names the square the pawn passed over: e3 after e2-e4, for example. Otherwise it is a dash.

Notation standards differ slightly here. Some writers record the target square any time a two-square pawn move was played, while others record it only when an enemy pawn is actually positioned to capture. Either way, the field exists so a program can offer the legal en passant capture.

Fields 5 and 6: the clocks

The halfmove clock counts plies since the last capture or pawn move. When it reaches 100, the fifty-move rule allows either player to claim a draw. It resets to 0 after any capture or pawn move.

The fullmove number starts at 1 and increments after every Black move, so it counts complete move pairs rather than individual plies.

Where FEN is useful

  • Pasting a specific position into an analysis board without replaying the whole game.
  • Sharing a puzzle or a position in a message, where a screenshot would lose the details of turn and castling.
  • Recording a position in a database row, because it is one short string rather than a game's worth of moves.
  • Setting up an endgame study, where you want to start from a position rather than play into it.
  • Comparing positions for repetition, since two visually identical boards with different castling rights are not the same position.

Frequently asked questions

Is FEN case sensitive?
Yes. Uppercase and lowercase letters mean different things: uppercase is White, lowercase is Black. Turning B into b would move a bishop from White to Black.
Can a FEN describe an illegal position?
The text can be syntactically valid while the position is impossible, such as two White kings or a pawn on the first rank. A FEN validator checks the board layout and the side to move field, but a legal-looking FEN is not proof the position arose from a real game.
How is FEN different from EPD?
EPD, the Extended Position Description, uses the same first four fields as FEN but replaces the move counters with space for operations such as best move or a position identifier. It is used for engine test suites rather than game records.
Do I need FEN if I already have PGN?
Often not. PGN implies every position along the way. FEN is the right tool when you want a single arbitrary position, or when you want to start a board somewhere other than the initial position.