HomeLearn to Play ChessImprove Your GameChess HistoryChess for FunChess Blog

Portable Game Notation (PGN)
Downloading games is a popular chess activity on the Internet. PGN makes it simple.


Computers and the Internet have had a profound impact on the game of chess. Opening & game databases, tactical calculation, endgame tablebases, online & email play, computer vs. computer, vs. human, algorithm & game theory, have all been with us for less than an average human lifetime.

The advances in chess have paralleled the advances in computing. The first mainframes to play chess knew little more than how the pieces moved. The best programs today, running on tiny processors, easily beat all but the best human players. One of the greatest advances in the last ten years has been the ability to exchange game scores in digital formats. This has led to databases of millions of games that can be searched in a few seconds.

All commercial chess database software is built around some database format which is proprietary to that software. Databases in that format can be exchanged only between owners of the software. A more general exchange of data between owners of incompatible software packages requires a neutral format which is understood by both packages.

Fortunately for the chess world a neutral format was created in the mid-1990s and caught on quickly. It's called Portable Game Notation (PGN). Files using PGN encoding are usually assigned the extension *.PGN. Here's a sample game in PGN format.

[Event "chp"]
[Site "USA"]
[Date "1956.??.??"]
[Round "?"]
[White "Byrne, D."]
[Black "Fischer, R."]
[Result "0-1"]

1.Nf3 Nf6 2.c4 g6 3.Nc3 Bg7 4.d4 O-O 5.Bf4 d5 6.Qb3 dxc4 7.Qxc4 c6 8.e4 Nbd7 9.Rd1 Nb6 10.Qc5 Bg4 11.Bg5 Na4 12.Qa3 Nxc3 13.bxc3 Nxe4 14.Bxe7 Qb6 15.Bc4 Nxc3 16.Bc5 Rfe8+ 17.Kf1 Be6 18.Bxb6 Bxc4+ 19.Kg1 Ne2+ 20.Kf1 Nxd4+ 21.Kg1 Ne2+ 22.Kf1 Nc3+ 23.Kg1 axb6 24.Qb4 Ra4 25.Qxb6 Nxd1 26.h3 Rxa2 27.Kh2 Nxf2 28.Re1 Rxe1 29.Qd8+ Bf8 30.Nxe1 Bd5 31.Nf3 Ne4 32.Qb8 b5 33.h4 h5 34.Ne5 Kg7 35.Kg1 Bc5+ 36.Kf1 Ng3+ 37.Ke1 Bb4+ 38.Kd1 Bb3+ 39.Kc1 Ne2+ 40.Kb1 Nc3+ 41.Kc1 Rc2+ 0-1

The format is defined in a document called the PGN Specification and Implementation Guide which can be found on the Web. The document defines all necessary formats for encoding chess game data using text files.

A PGN game score has two sections, formally known as the:-

  • Tag pair section and
  • Movetext section

The tag pairs are the lines enclosed in square brackets ('[' and ']'). Each tag pair consists of a tag name plus its value. In the tag pair '[Event "chp"]', 'Event' is the tag name and 'chp' is its value. It's clear from the tags that the game score is the well-known 'Game of the century' which 13-year old Bobby Fischer won against Donald Byrne in the 1956 U.S. Championship.

The movetext section is the game score in algebraic notation, which the PGN document calls Standard Algebraic Notation (SAN). The document defines details like 'O-O' instead of '0-0' for castling, and '=' for promotions ('c8=Q').

The tags in the Byrne - Fischer example ('Event', 'Site', 'Date', 'Round', 'White', 'Black', & 'Result') are collectively known as the Seven Tag Roster (STR). [In the computer world everything gets an acronym. There's the famous story of the technician who was confused by the meaning of 'FAN' on a schematic until he was told to look it up in the dictionary.]

Every PGN game score is required to have those seven tags. The PGN document says, 'The interpretation of these tags is fixed as is the order in which they appear. Although the definition and use of additional tag names and semantics is permitted and encouraged when needed, the STR is the common ground that all programs should follow for public data interchange.' If the value of one of the seven tags is unknown, it is filled with '?', as seen in the 'Round' tag from the example.

Other tags in common use are 'ECO', which gives the ECO classification, and 'Annotator', which gives the name of the person annotating the game. Yes, the PGN document standardizes the format for game comments. It also doesn't require a game to start from the initial position. The 'FEN' tag (Forsyth-Edwards Notation), described in the document, can be used to specify any legal chess position.

The great advantage of PGN is that it can be read and easily understood by people and by computers. Written in 1994 by Steven J. Edwards, the PGN document saw widespread distribution via the Internet and within a few years had become *the* standard. Today it is rare to see a text file using any other standard.

What are the disadvantages of the PGN standard? One common complaint is that its text-based encoding is not particularly efficient. The same data in ChessBase format uses about half the disk space. Web site operators with large chess databases often prefer to distribute their data in ChessBase or other format to save on disk costs. Even when compressed using ZIP, the space savings of a chess-specific format are substantial.

Another disadvantage is that there are no general guidelines for the values. The 'Site' tag value is often crammed into the 'Event' tag or vice versa. The values can be terse to the point of incomprehensible : [Event "ct"] means a candidates tournament. Players names are not written uniformly in all databases and not every chess program knows that Chirov and Shirov can be the same person.

But these problems are insignificant compared to the advantages of PGN. Searching and downloading game files is one of the most popular chess activities on the Internet, and PGN can take a lot of credit for this popularity. The quote from the introduction to the PGN document...

If now, while they are one people, all speaking the same language, they have started to do this, nothing will later stop them from doing whatever they propose to do. - Genesis XI, v.6

...is apt indeed.