Skip to the study

Study24Study guide

What is PGN in chess: the format explained

PGN (Portable Game Notation) is the plain text format used to store and exchange chess games between programs and websites. This guide shows each part of the file, a complete verified example, and the paths to export from Chess.com and Lichess and import the game elsewhere.

  • Importing
  • Tools
  • Study

Type

Study guide

24

Reading time
6 min read
In this study
7 sections
Updated
December 2, 2026

What a PGN file is

A PGN is a text file, not a binary format, with two sections: a list of bracketed tags that identify the game, and the numbered moves ending with the result. The specification, coordinated by Steven J. Edwards and available online since 1994, defines the format so that any chess program can read what another program produced. That portability is why PGN is still the common language between Chess.com, Lichess and every other chess tool thirty years later.

The specification defines two variants: an import format, tolerant, for data prepared by hand, and an export format, strict, for program-generated files. In practice you only need to know that the file is text: you can open it in any text editor, read the header and follow the moves with a board.

Want to step through a PGN file immediately in your browser? Open our free online chess PGN viewer.

Tag pairs and the Seven Tag Roster

Tags have the form `[Name "Value"]`. The specification mandates seven of them, the Seven Tag Roster: Event, Site, Date, Round, White, Black and Result, always in that order in export files. Unknown values use `?`, and a game without a round number uses `-`. The result takes one of four values: `1-0`, `0-1`, `1/2-1/2` or `*` for a game in progress or an unknown result.

Other tags are allowed and common, such as TimeControl, ECO, Opening and WhiteElo. Games that do not start from the standard initial position require the SetUp and FEN tags; without them, any reader replays the moves from the initial position and the import fails.

TagWhat it recordsExample
EventThe event or the type of gameCasual game
SiteWhere the game was playedOnline
DateThe date, as YYYY.MM.DD2026.11.18
RoundThe round, or a hyphen when there is none-
WhiteThe player of the white piecesPlayerA
BlackThe player of the black piecesPlayerB
ResultThe same value that ends the movetext1-0

The moves in SAN notation

The movetext uses SAN (Standard Algebraic Notation), defined in the PGN specification itself. Pieces are abbreviated by letters, always in English even on sites in other languages: K for king, Q for queen, R for rook, B for bishop and N for knight. Pawns get no letter. Captures use `x`, and pawn captures include the file of origin, as in `exd5`. Castling is `O-O` or `O-O-O`, with the letter O, never the digit zero. Promotion uses `=`, as in `e8=Q`. Check adds `+` and checkmate adds `#`.

When two pieces of the same type can reach the same square, the move says which one, by file or rank of origin, as in `Nbd7`. The movetext ends with the same result value as the Result tag. This predictability is what lets a reader replay the game move by move without ambiguity.

A complete verified example

The example below is a four-move miniature ending in checkmate. It was generated with the python-chess rules library and verified move by move: every move is legal and the final position is checkmate. Each line is one element of the file.

`[Event "Casual game"]`

`[Site "Online"]`

`[Date "2026.11.18"]`

`[Round "-"]`

`[White "PlayerA"]`

`[Black "PlayerB"]`

`[Result "1-0"]`

`1. e4 e5 2. Bc4 Nc6 3. Qh5 Nf6 4. Qxf7# 1-0`

Read the movetext: `4. Qxf7#` is the white queen capturing on f7 and delivering mate, protected by the bishop on c4. The trailing `1-0` repeats the Result tag, as the export format requires. The same file re-imports cleanly, which is the practical definition of a valid PGN.

Comments, variations and glyphs

PGN supports human annotation. Text between braces `{ }` attaches a comment to a move, and a semicolon `;` comments to the end of the line. Alternative lines go inside parentheses, called RAV (Recursive Annotation Variation) in the specification, as in `(2... Nf6 3. Nxe5)` after a game opening `1. e4 e5 2. Nf3`. Numeric annotation glyphs such as `$1` for a good move and `$2` for a poor one allow compact annotation that different programs display with the same meaning.

A practical consequence: when a PGN fails to import, the problem is usually a broken comment (an unclosed brace) or an incomplete variation, not the moves themselves.

How to export from Chess.com and Lichess

On Chess.com, open the finished game, go to the analysis panel and use the share icon; the PGN tab offers copy or download, with an option to include the clock times. On Lichess, open the game and use the PGN export option in the game menu; the public API also delivers a user's games as PGN. The exact path, with screenshots-level detail and the mobile steps, is in how to import Chess.com and Lichess games.

Before you close the tab or trust a single tool, keep the file: the PGN is your permanent record of the game, independent of any interface.

Importing elsewhere and common errors

Lichess imports at lichess.org/paste: paste the text and you get a browsable game, with the option to request a computer analysis; the page itself notes that a pasted PGN is public, and that a study is the place to import privately. Deblunder accepts PGN files in its diagnosis: the full flow is in how Deblunder works. For what to do with the game once it is imported, the study workflow is in how to analyze a chess game.

Common errors when pasting PGN, all avoidable with a quick look at the file:

  • Pasting the rendered text of a web page instead of the PGN itself, which brings spaces and wrong quotes.
  • Pasting only part of the game, without the result at the end.
  • Joining several games without a blank line between them.
  • Deleting tags you did not recognize, mainly SetUp and FEN in games that start from a different position.
  • Renaming the file with the .pgn extension when a reader filters by extension; the content is what matters, but the suffix avoids rejections.

Frequently asked questions

What does PGN mean in chess?

Portable Game Notation: the standard text format for storing and exchanging chess games. It defines identifying tags and the move list in SAN notation, and any chess program can read it.

How do I download the PGN of my Chess.com game?

Open the finished game, use the share icon in the analysis panel and choose the PGN tab. The guide How to import Chess.com and Lichess games details the path, including mobile.

How do I download the PGN of a Lichess game?

Use the PGN export option in the game menu, or the public Lichess API for a user's games. Private or deleted games are not exported.

Why does my PGN fail to import?

The most common causes are incomplete text, a missing result, an unclosed brace comment, several games pasted without a separator, or a game that starts from a different position without the FEN and SetUp tags.

What is the difference between PGN and FEN?

PGN records a whole game, tags and moves. FEN records a single position, with the side to move and castling rights. A PGN of a game that starts from a different position carries the FEN in a tag.

Sources and further reading