Forsyth–Edwards Notation (FEN) is a standardnotation for describing a particular board position of achess game. The purpose of FEN is to provide all the necessary information to restart a game from a particular position.
FEN is based on a system developed byScottish newspaper journalistDavid Forsyth. His system became popular in the 19th century, thenSteven J. Edwards extended it to support its use by computers. FEN is defined[2] in the "Portable Game Notation Specification and Implementation Guide".[1] In thePortable Game Notation for chess games, FEN is used to define initial positions other than the standard one.[3] FEN does not provide sufficient information to decide whether adraw bythreefold repetition may be legally claimed or adraw offer may be accepted; for that, a different format such asExtended Position Description is needed.
A FEN record defines a particular game position, all in one text line and using only the ASCII character set. A text file with only FEN data records should use thefilename extension.fen
.[4]
A FEN record contains six fields, each separated by a space. The fields are as follows:[5]
The following example is from the FEN specification:[10]
Here is the FEN for the starting position:
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
And after the move 1.e4:
rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR b KQkq e3 0 1
And then after 1...c5:
rnbqkbnr/pp1ppppp/8/2p5/4P3/8/PPPP1PPP/RNBQKBNR w KQkq c6 0 2
And then after 2.Nf3:
rnbqkbnr/pp1ppppp/8/2p5/4P3/5N2/PPPP1PPP/RNBQKB1R b KQkq - 1 2
FEN is crucial for recording games in chess variants such asChess960 (also known as Fischer Random Chess), where the initial position is not necessarily the traditional initial position. However, the FEN castling availability encoding (KQkq) is inadequate when both rooks are on the same side of the king on the back rank (as a result of one rook having moved, or in a form of randomised chess that allows it in a starting position): if either rook is still available for castling, it would be ambiguous which rook this is without knowing their initial positions. The solution implemented by chess engines like Shredder and Fritz_9 is to use the letters of the columns on which the rooks began the game. This scheme is sometimes called Shredder-FEN.[11] For the traditional setup, Shredder-FEN would use AHah instead of KQkq.
Another solution is offered byX-FEN, which offers more backward compatibility than Shredder-FEN does, but at the cost of more complexity.