Numeric Annotation Glyphs
   HOME

TheInfoList



OR:

Portable Game Notation (PGN) is a standard
plain text In computing, plain text is a loose term for data (e.g. file contents) that represent only characters of readable material but not its graphical representation nor other objects ( floating-point numbers, images, etc.). It may also include a lim ...
format for recording
chess Chess is a board game for two players. It is an abstract strategy game that involves Perfect information, no hidden information and no elements of game of chance, chance. It is played on a square chessboard, board consisting of 64 squares arran ...
games (both the moves and related
data Data ( , ) are a collection of discrete or continuous values that convey information, describing the quantity, quality, fact, statistics, other basic units of meaning, or simply sequences of symbols that may be further interpreted for ...
), which can be read by humans and is also supported by most chess software.


History

PGN was devised around 1993, by
Steven J. Edwards Stephen or Steven is an English given name, first name. It is particularly significant to Christianity, Christians, as it belonged to Saint Stephen ( ), an early disciple and deacon who, according to the Book of Acts, was stoned to death; he is w ...
, and was first popularized and specified via the
Usenet Usenet (), a portmanteau of User's Network, is a worldwide distributed discussion system available on computers. It was developed from the general-purpose UUCP, Unix-to-Unix Copy (UUCP) dial-up network architecture. Tom Truscott and Jim Elli ...
newsgroup rec.games.chess.


Usage

PGN is structured "for easy reading and writing by human users and for easy
parsing Parsing, syntax analysis, or syntactic analysis is a process of analyzing a String (computer science), string of Symbol (formal), symbols, either in natural language, computer languages or data structures, conforming to the rules of a formal gramm ...
and generation by
computer program A computer program is a sequence or set of instructions in a programming language for a computer to Execution (computing), execute. It is one component of software, which also includes software documentation, documentation and other intangibl ...
s." The chess moves themselves are given in
algebraic chess notation Algebraic notation is the standard method of chess notation, used for recording and describing moves. It is based on a system of coordinates to identify each square on the board uniquely. It is now almost universally used by books, magazines, n ...
using English initials for the pieces. The
filename extension A filename extension, file name extension or file extension is a suffix to the name of a computer file (for example, .txt, .mp3, .exe) that indicates a characteristic of the file contents or its intended use. A filename extension is typically d ...
is .pgn. There are two formats in the PGN specification, the "import" format and the "export" format. The import format describes data that may have been prepared by hand, and is intentionally lax; a program that can read PGN data should be able to handle the somewhat lax import format. The export format is rather strict and describes data prepared under program control, similar to a pretty printed source program reformatted by a
compiler In computing, a compiler is a computer program that Translator (computing), translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primaril ...
. The export format representations generated by different programs on the same computer should be exactly equivalent, byte for byte. PGN text begins with a set of "tag pairs" (a tag name and its value), followed by the "movetext" (chess moves with optional commentary).


Tag pairs

Tag pairs begin with an initial left bracket , followed by the name of the tag in plain
ASCII ASCII ( ), an acronym for American Standard Code for Information Interchange, is a character encoding standard for representing a particular set of 95 (English language focused) printable character, printable and 33 control character, control c ...
text. The tag value is enclosed in double-quotes, and the tag is then terminated with a closing right bracket . A quote inside a tag value is represented by the backslash immediately followed by a quote. A backslash inside a tag value is represented by two adjacent backslashes. There are no special control codes involving escape characters, or carriage returns, and linefeeds to separate the fields, and superfluous embedded spaces are usually skipped when parsing.


Seven Tag Roster

PGN data for archival storage is required to provide seven tag pairs – together known as the "''Seven Tag Roster''". In export format, these tag pairs must appear before any other tag pairs and in this order:


Optional tag pairs

The standard allows for other optional tag pairs. The more common ones include:


Movetext

Chessboard notation, frame The movetext describes the actual moves of the game. This includes move number indicators (numbers followed by either one or three periods; one if the next move is White's move, three if the next move is Black's move) and movetext in
Standard Algebraic Notation Algebraic notation is the standard method of chess notation, used for recording and describing moves. It is based on a system of coordinates to identify each square on the board uniquely. It is now almost universally used by books, magazines, new ...
(SAN). For most moves the SAN consists of the letter abbreviation for the piece, an x if there is a capture, and the two-character algebraic name of the final square the piece moved to. The letter abbreviations are K (
king King is a royal title given to a male monarch. A king is an Absolute monarchy, absolute monarch if he holds unrestricted Government, governmental power or exercises full sovereignty over a nation. Conversely, he is a Constitutional monarchy, ...
), Q (
queen Queen most commonly refers to: * Queen regnant, a female monarch of a kingdom * Queen consort, the wife of a reigning king * Queen (band), a British rock band Queen or QUEEN may also refer to: Monarchy * Queen dowager, the widow of a king * Q ...
), R (
rook Rook or rooks may refer to: Games *Rook (chess), a piece in chess that moves horizontally and vertically * Rook (card game), a trick-taking card game People, characters, individuals *a rookie, a rook * Russell Rook, Baron Rook (The Lord Rook; 21 ...
), B (
bishop A bishop is an ordained member of the clergy who is entrusted with a position of Episcopal polity, authority and oversight in a religious institution. In Christianity, bishops are normally responsible for the governance and administration of di ...
), and N (
knight A knight is a person granted an honorary title of a knighthood by a head of state (including the pope) or representative for service to the monarch, the church, or the country, especially in a military capacity. The concept of a knighthood ...
). The
pawn Pawn most often refers to: * Pawn (chess), the weakest and most numerous chess piece in the game * Pawnbroker or pawnshop, a business that provides loans by taking personal property as collateral Pawn or The Pawn may also refer to: Places * Pa ...
is given an empty abbreviation in SAN movetext, but in other contexts the abbreviation P is used. The algebraic name of any square is as per usual algebraic chess notation; from white's perspective, the leftmost square closest to white is a1, the rightmost square closest to the white is h1, and the rightmost (from white's perspective) square closest to black side is h8. In a few cases, a more detailed representation is needed to resolve ambiguity; if so, the piece's
file File or filing may refer to: Mechanical tools and processes * File (tool), a tool used to remove fine amounts of material from a workpiece. ** Filing (metalworking), a material removal process in manufacturing ** Nail file, a tool used to gen ...
letter, numerical
rank A rank is a position in a hierarchy. It can be formally recognized—for example, cardinal, chief executive officer, general, professor—or unofficial. People Formal ranks * Academic rank * Corporate title * Diplomatic rank * Hierarchy ...
, or the exact square is inserted after the moving piece's name (in that order of preference). Thus, Nge2 specifies that the knight originally on the g-file moves to e2. SAN
kingside This glossary of chess explains commonly used terms in chess, in alphabetical order. Some of these terms have their own pages, like ''fork'' and '' pin''. For a list of unorthodox chess pieces, see Fairy chess piece; for a list of terms specific ...
castling Castling is a move in chess. It consists of moving the king (chess), king two squares toward a rook (chess), rook on the same and then moving the rook to the square that the king passed over. Castling is permitted only if neither the king ...
is indicated by the sequence O-O;
queenside This glossary of chess explains commonly used terms in chess, in alphabetical order. Some of these terms have their own pages, like ''fork'' and ''pin''. For a list of unorthodox chess pieces, see Fairy chess piece; for a list of terms specific t ...
castling is indicated by the sequence O-O-O (note that these are capital Os, not zeroes, contrary to the
FIDE The International Chess Federation or World Chess Federation, commonly referred to by its French acronym FIDE ( , ), is an international organization based in Switzerland that connects the various national chess federations and acts as the Spor ...
standard for notation). Pawn promotions are notated by
append In computer programming, append is the operation for concatenating linked lists or arrays in some high-level programming languages. Lisp Append originates in the programming language Lisp. The append procedure takes zero or more (linked) lists a ...
ing = to the destination square, followed by the piece the pawn is promoted to. For example: e8=Q. If the move is a checking move, + is also appended; if the move is a checkmating move, # is appended instead. For example: e8=Q#. An annotator who wishes to suggest alternative moves to those actually played in the game may insert variations enclosed in parentheses. They may also comment on the game by inserting Numeric Annotation Glyphs (NAGs) into the movetext. Each NAG reflects a subjective impression of the move preceding the NAG or of the resultant position. If the game result is anything other than *, the result is repeated at the end of the movetext.


Comments

Comments are inserted by either a ; (a comment that continues to the end of the line) or a ). Comments do not nest.


Example

Here is the PGN format of the 29th game of the 1992 match played in
Yugoslavia , common_name = Yugoslavia , life_span = 1918–19921941–1945: World War II in Yugoslavia#Axis invasion and dismemberment of Yugoslavia, Axis occupation , p1 = Kingdom of SerbiaSerbia , flag_p ...
between
Bobby Fischer Robert James Fischer (March 9, 1943January 17, 2008) was an American Grandmaster (chess), chess grandmaster and the eleventh World Chess Championship, World Chess Champion. A chess prodigy, he won his first of a record eight US Chess Champi ...
and
Boris Spassky Boris Vasilyevich Spassky (; January 30, 1937 – February 27, 2025) was a Russian chess grandmaster who was the tenth World Chess Champion, holding the title from 1969 to 1972. Spassky played three world championship matches: he lost to Tigra ...
:


Handling chess variants

Many
chess variant A chess variant is a game related to, derived from, or inspired by chess. Such variants can differ from chess in many different ways. "International" or "Western" chess itself is one of a family of games which have related origins and could be co ...
s can be recorded using PGN, provided the names of the pieces can be limited to one character, usually a letter and not a number. They are typically noted with a tag named "Variant" giving the name of the rules. The term "Variation" must be avoided, as that refers to the name of an opening variation. Note that traditional chess programs can only handle, at most, a few variants. Forsyth-Edwards Notation is used to record the starting position for variants (such as
Chess960 Chess960, also known as Fischer Random Chess, is a chess variant that randomizes the starting position of the pieces on the back rank. It was introduced by former world chess champion Bobby Fischer in 1996 to reduce the emphasis on opening prepa ...
) which have initial positions other than the orthodox chess initial position.


Numeric Annotation Glyphs

Numeric Annotation Glyphs or NAGs are used to annotate chess games when using a computer, typically providing an assessment of a chess move or a chess position. NAGs exist to indicate a simple annotation in a language independent manner. NAGs were first formally documented in 1994 by Steven J. Edwards in his "Portable Game Notation Specification and Implementation Guide". Within the PGN specification, 256 NAGs are proposed of which the first 140 are defined; the remainder were reserved for future definition. A Numeric Annotation Glyph is composed of a dollar sign character ("$") immediately followed by one or more digit characters. Each NAG then has a specific meaning and often a standard typographical representation. The meanings first defined stemmed from the use of specific typographic symbols when annotators were commenting upon chess games; most especially in
Chess Informant Chess Informant () is a publishing company from Belgrade, Serbia, that periodically (since 2012, four volumes per year) produces volumes of a book entitled ''Chess Informant'', as well as the ''Encyclopaedia of Chess Openings'', ''Encyclopaedia ...
''Uses FigurineCB webfont.'' publications. The objective was to devise an alternative representation of these symbols which could be incorporated in the simple computer file format proposed as the PGN standard. This mechanism allowed often sophisticated typography to be expressed using the simple ASCII character set. Since its inception there has been no attempt to further formalise or standardise the meaning of the undefined 116 NAGs although PGN editors, such as ChessPad, have variously used these higher glyphs.


Standard NAGs


Non-standard NAGs


Notes on tables

# Some of the symbols are not rendered by some browsers # The more exotic symbols used by Chess Informator are often derived from common mathematical typographic symbols; their mathematical meaning rarely has any relevance to their chess meaning # The entries in the Unicode column are, respectively, the decimal and hexadecimal reference for the character or symbol # The entries in the HTML column are named
HTML entities In SGML, HTML and XML documents, the logical constructs known as ''character data'' and ''attribute values'' consist of sequences of characters, in which each character can manifest directly (representing itself), or can be represented by a series ...
for representing the symbol or character; the Unicode numeric value can always be used where a specific entity does not exist. For example, the ''left right double arrow'' ($239) can be represented as either Unicode decimal ⇔ (⇔) or Unicode hexadecimal ⇔ (⇔) or HTML ⇔ (⇔). Unless explicitly noted, the Unicode representation can be interpreted as a default.


See also

*
Forsyth–Edwards Notation Forsyth–Edwards Notation (FEN) is a standard Chess notation, notation for describing a particular board position of a chess game. The purpose of FEN is to provide all the necessary information to restart a game from a particular position. FEN i ...
*
X-FEN X-FEN (formerly FRC-FEN) is an extension of Forsyth–Edwards Notation (FEN) introduced by Reinhard Scharnagl in 2003. It was designed to be able to represent all possible positions in Fischer random chess (FRC) and Capablanca random chess (CRC). ...
*
Smart Game Format The Smart Game Format (SGF) is a file format used for storing records of board games. Go is the game that is most commonly represented in this format and is the default. SGF was originally created under a different name by Anders Kierulf for ...
– Format for recording Go games *
Portable Draughts Notation Portable Draughts Notation (.PDN) is the standard computer-processable format for recording draughts games. This format is derived from Portable Game Notation, which is the standard chess format. PDN files are text files which must contain Tag Pa ...


Notes


References


Sources

* Krogius, N; Livsic, A; Parma, B; Tajmanov, M. ''Encyclopedia of Chess Middlegames''. (1980) Belgrade: Chess Informant. * Malanovic, Aleksander (Editor) ''Encyclopedia of Chess Openings, volumes A-E''. (1978) Belgrade: Chess Informant. {{Chess Chess notation Computer file formats 1993 introductions