GuidesTools
PGN Files Explained for Chess Players
PGN is the plain-text format every chess program agrees on. Here is what is inside one and how to move your games between apps.
What PGN is
PGN stands for Portable Game Notation. It is a plain-text format for recording chess games, written in the 1990s, and every chess program can still read and write it.
A PGN file is just text. You can open one in a text editor and read it without any special software.
That matters more than it sounds. Because the format is plain and universally supported, your games and your analysis are not trapped in whichever app you happened to use.
Everything on the left of that diagram can write PGN. Everything on the right can read it. There is no converter in the middle, because there is nothing to convert.
What is inside one
A PGN entry has two parts: a set of tags, then the moves.
The bracketed lines are the tag pairs. Seven are standard: Event, Site, Date, Round, White, Black and Result. A file is still valid if others are missing, or if extra ones are added.
Everything after the blank line is the movetext. The moves are in standard algebraic notation, numbered, and the result comes last. 1-0 means White won, 0-1 means Black won, 1/2-1/2 is a draw, and * means the game is unfinished or the file is a study rather than a game.
Comments and variations
Two additions turn a game record into something you can study from.
Comments go in curly braces. Engines ignore them and most software displays them:
3. f4 {The Vienna Gambit. White offers a pawn to open the f-file.} exf4
Variations go in parentheses and hold alternatives to the move just played:
3... d5 (3... exf4 4. e5 {the main alternative} 4... Qe7) 4. fxe5
Variations can nest, and that is how a whole repertoire fits into one file. The main line runs through the movetext and every alternative branches off in parentheses. A repertoire PGN often has more text inside parentheses than outside them.
You may also see symbols such as !, ? or !?, and numeric glyphs such as $1. These are judgements on the move before them, and it is safe to ignore them.
Exporting from the major sites
Lichess. For one game, open it and choose PGN from the share menu. For a study, use the download option, which exports every chapter as a single file. For all of your own games, the export page under your profile preferences produces one archive.
Chess.com. Individual games have a download option in the sharing controls under the board. Bulk exports live in the games section of your account rather than beside a single game.
ChessBase. Databases use ChessBase’s own formats, so you need an explicit conversion. Select the games and export or save as PGN rather than copying the database file. Some ChessBase-specific annotation may not survive the trip.
Your own board. Most analysis boards, including the ones inside training apps, will produce PGN for whatever line is loaded.
Things that commonly go wrong
- The file holds more than one game. PGN files can contain thousands, separated by blank lines. If an import only shows the first, the software probably expects one game per file, or has a separate bulk import.
- Encoding. Player names with accents arrive mangled if the file was saved in the wrong encoding. Saving as UTF-8 fixes most cases.
- Line breaks. PGN allows moves to wrap across lines, and some editors helpfully “fix” this in ways that break the file. Edit in a plain-text editor, never a word processor.
- Very large files. A database export of tens of thousands of games is valid PGN, but most study tools are not built to load one. Split it first.
Why the format is worth understanding
Once you know what PGN is, you stop thinking of your analysis as something that lives inside an account. It is a text file you own. You can back it up, email it, and load it into whatever tool you use next year.
In practice that means you can build a repertoire in one place and train it in another. Keep studies on Lichess and drill them elsewhere. Build lines on your phone and analyse them on a desktop.
That portability is why Chess Prep Pro reads PGN text, PGN files and Lichess studies, and exports all of it straight back out again.