PGN Format Explained: How to Read and Write Chess Game Notation
A plain-English breakdown of the PGN standard — tag pairs, movetext, comments, and result codes — so you can read, write, or fix any chess game file.
PGN — Portable Game Notation — is the plain-text standard almost every chess program uses to store games. It looks intimidating the first time you open one in a text editor, but the format is simple once you know what each part is for. Here is every piece of a PGN file, explained.
The two parts of every PGN
A PGN game has exactly two sections: a block of tag pairs at the top, and the movetext below it. The tags describe the game; the movetext is the game itself.
Tag pairs
Tags look like [Event "World Championship"] — a name in square brackets followed by a quoted value. The PGN standard defines a minimum set called the Seven Tag Roster:
Event— the name of the tournament or match.Site— where the game was played.Date— inYYYY.MM.DDformat, with??for unknown parts.Round— the round number, if applicable.WhiteandBlack— the players’ names.Result—1-0,0-1,1/2-1/2, or*for an unfinished game.
Most exports add extra tags too, like ECO (the opening code), WhiteElo, BlackElo, or TimeControl. None of these are strictly required for a file to be readable — a parser only truly needs the movetext — but including them is good practice for anything you plan to keep.
Movetext
After the tags comes the actual game, written in standard algebraic notation with move numbers:
1. e4 e5 2. Nf3 Nc6 3. Bb5 a6 4. Ba4 Nf6 5. O-O Be7 1-0
Each White move is preceded by its number and a period; Black’s reply follows with no number needed (though 5...Be7 style numbering is also valid and common when a comment breaks the line). The movetext always ends with the result, repeated from the Result tag.
Comments and annotations
Free-text comments go in curly braces: 3. Bb5 {the Ruy Lopez}. Alternate lines the annotator considered go in parentheses as a variation, and can nest. Numeric Annotation Glyphs like $1(a good move, displayed as “!”) or $4(a blunder, “??”) are a compact, language-independent way to mark move quality. Most analysis tools strip comments and variations automatically and just play through the main line, so a heavily annotated PGN is still safe to import anywhere.
A minimal, fully valid example
Tags are optional beyond the roster, and even the roster can be left mostly blank. This is a complete, legal PGN:
[Event "?"] [Site "?"] [Date "????.??.??"] [Round "?"] [White "?"] [Black "?"] [Result "*"] 1. e4 e5 *
This is why typing a scoresheet by hand works fine — you do not need to fill in every tag correctly for a tool to accept and analyze the file. See more ready-to-use annotated PGN examples if you want full games to copy.
Common formatting mistakes
A few issues break strict parsers: descriptive notation instead of algebraic (P-K4 instead of e4), unmatched braces or parentheses, and a missing result terminator at the very end. A lenient parser can usually recover from a missing tag, but a malformed movetext line is the most common reason an import fails.
Once your file is valid, paste it into Chesslume for a free Stockfish report — no installation, and no need to understand the format at all to use it.
Analyze your own games free
Import from Chess.com or Lichess — unlimited, no signup, powered by Stockfish.
