FEN and PGN Explained: How to Load Any Chess Position or Game
Chess has two standard text formats. FEN describes a single position. PGN records a whole game. Both work on our analysis board, and PGN works in the game report too.
FEN: one position in one line
The starting position in FEN is:
| Starting position |
|---|
| rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1 |
It has six fields separated by spaces:
| Field | Example | Meaning |
|---|---|---|
| Pieces | rnbqkbnr/pppppppp/8/... | Each rank from 8 down to 1, files a to h. Uppercase is White, lowercase is Black; numbers are empty squares. |
| Side to move | w | w for White, b for Black |
| Castling | KQkq | Which castling rights remain; - if none |
| En passant | - | The square a pawn can be captured on en passant, or - |
| Halfmove clock | 0 | Moves since the last capture or pawn move (for the 50-move rule) |
| Move number | 1 | The full move number |
Letters stand for pieces: K king, Q queen, R rook, B bishop, N knight, P pawn. Our board accepts a FEN without the last two fields and fills them in.
The board refuses positions the engine can't handle: a side without exactly one king, pawns on the first or last rank, or the side not to move standing in check.
PGN: a whole game
A PGN file starts with tags in square brackets and then lists the moves in standard notation:
| Part | Example |
|---|---|
| Tags | [White "Paul Morphy"] [Result "1-0"] |
| Moves | 1. e4 e5 2. Nf3 d6 3. d4 Bg4 |
| Comments | {Good move} or clock times like {[%clk 0:02:59]} |
| Variations | (2... Nc6) in parentheses |
| Result | 1-0, 0-1, 1/2-1/2 or * |
When you load a PGN we follow the main line and ignore side variations. Games that start from a custom position carry SetUp and FEN tags, which we read as well.
Where to get them
- From a game report: every report can copy the game's PGN or open the current position on the analysis board.
- From Chess.com or Lichess: you usually don't need to copy anything; import your games by username in the import box.
- From a book or a diagram: set up the position on the analysis board by playing the moves, or type the FEN by hand.
Annotated PGN
A Pro review can be downloaded as an annotated PGN: each move carries the engine evaluation as an [%eval] comment, mistakes get the usual ?!, ? and ?? marks, and the better line is added as a variation. Any program that reads PGN can open it.
Unlimited game review with Stockfish, running on your own device.