Fandom

File Formats Wiki

Portable Game Notation

261pages on
this wiki
Add New Page
Talk0 Share
Portable Game Notation
Blank

Filename extension .pgn
File formats category - v  e   edit

Portable Game Notation (PGN) is a file format for recording chess games.

Smallwikipedialogo.png Wikipedia has an article related to:

SpecificationEdit

PGN code begins with a set of tag pairs, followed by the moves ("movetext") section. If the result of the game is not "*" (see Tag pairs), it is appended at the end of the movetext section.

Tag pairsEdit

A tag pair is enclosed in brackets ("[","]"). The contents are the name of the tag followed by its value, enclosed in quotation marks:

[Name "Linda"]

A tag pair section usually begins with the "Seven Tag Roster", which appears in the following order:

    • Event: the name of the tournament or event.
    • Site: the location of the event, in "<city>, <region> <country>" format, where <country> is the IOC country code for the country. Example: "New York City, NY USA"
    • Date: the starting date of the game, in "YYYY.MM.DD" format. Unknown values are specified by "??". Examples: "2008.12.09" and "2009.01.??".
    • Round: the round of the game. In some events where there are multiple round numbers, the numbers are delimited by a period. Examples: "2" and "4.2".
    • White: the player playing White, in "<last name>, <first name>" format.
    • Black: the player playing Black.
    • Result: the result of the game. There are only four possible values: "1-0" (White won), "0-1" (Black won), "1/2-1/2" (Draw), and "*" (Undetermined, e.g. game abandoned, still in progress).

Other common tags used are:

  • Time: Time the game started, in "HH:MM:SS" format, in local clock time.
  • Termination: Gives more details about the termination of the game. It may be "abandoned", "adjudication" (result determined by third-party adjudication), "death", "emergency", "normal", "rules infraction", "time forfeit", or "unterminated".
  • FEN: The initial position of the chess board, in Forsyth-Edwards Notation.

MovetextEdit

The movetext section consists of a sequence of moves in Standard Algebraic Notation. A move starts with a number followed by either one dot (White to move) or three dots (Black to move) followed by the corresponding move or moves. Example: "1. e4 e5 2. Nc3" and "20... Ke3"

Movetext SANEdit

Piece letters:

  • King - K
  • Queen - Q
  • Bishop - B
  • Knight - N
  • Rook - R
  • Pawn - (omitted)

Board square: The board square is specified as per the usual algebraic chess notation: the file letter followed by the rank number.

A move is usually indicated by the piece letter of the piece that moved, followed by the landing square of the move. If a capture is made, an "x" is inserted before the board square. There is a special case for pawns: the file letter of the source square of the move must be inserted before the "x".

En passant moves do not have special notation. In pawn promotions, an equal sign "=" followed by the promoted piece letter is appended.

In case of disambiguities (that is, another piece can also move to that square and result with the same notation), if they can be distinguished by file letter, the letter is inserted after the piece letter, otherwise if they can be be distinguished by rank number, the number is inserted, otherwise, the full source square is inserted. Note that it's impossible for this to occur for pawns.

Castling kingside is "O-O", castling queenside is "O-O-O" (letter Os are used).

Checking moves are appended with a plus sign "+"; checkmating moves are appended with a number sign "#".

CommentsEdit

  • Comments may be started using a semicolon ";" which continues to the end of the line, or enclosed within curly brackets "{}". Examples:
  • ;This is a comment
  • 1. e4 ; You can also go with 1... d4
  • 1. e4 {This is a comment} 1... e5

ExampleEdit

Here is an example from the Wikipedia article:

[Event "F/S Return Match"]
[Site "Belgrade, Serbia JUG"]
[Date "1992.11.04"]
[Round "29"]
[White "Fischer, Robert J."]
[Black "Spassky, Boris V."]
[Result "1/2-1/2"]
 
1. e4 e5 2. Nf3 Nc6 3. Bb5 {This opening is called the Ruy Lopez.} 3... a6
4. Ba4 Nf6 5. O-O Be7 6. Re1 b5 7. Bb3 d6 8. c3 O-O 9. h3 Nb8 10. d4 Nbd7
11. c4 c6 12. cxb5 axb5 13. Nc3 Bb7 14. Bg5 b4 15. Nb1 h6 16. Bh4 c5 17. dxe5
Nxe4 18. Bxe7 Qxe7 19. exd6 Qf6 20. Nbd2 Nxd6 21. Nc4 Nxc4 22. Bxc4 Nb6
23. Ne5 Rae8 24. Bxf7+ Rxf7 25. Nxf7 Rxe1+ 26. Qxe1 Kxf7 27. Qe3 Qg5 28. Qxg5
hxg5 29. b3 Ke6 30. a3 Kd6 31. axb4 cxb4 32. Ra5 Nd5 33. f3 Bc8 34. Kf2 Bf5
35. Ra7 g6 36. Ra6+ Kc5 37. Ke1 Nf4 38. g3 Nxh3 39. Kd2 Kb5 40. Rd6 Kc5 41. Ra6
Nf2 42. g4 Bd3 43. Re6 1/2-1/2

This page uses CC-BY-SA content from Wikipedia (authors). Smallwikipedialogo.png

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.