What Is PGN in Chess? The PGN Format Explained, With Examples
PGN (Portable Game Notation) is the standard text format for saving chess games. Every chess site, app and engine reads it. This guide shows what a PGN file looks like, what each part means, and how to download, open, import and export your games.
- A PGN example, line by line
- PGN tags: the Seven Tag Roster
- How the moves and results are written
- Comments, variations and annotation symbols
- PGN and FEN: what is the difference?
- How to download the PGN of your games
- How to open and import a PGN file
- How to export (save) a PGN
- Common PGN problems and how to fix them
- A short history of PGN
- Frequently asked questions
- Sources and checks
PGN stands for Portable Game Notation. It is a plain-text format for recording chess games, created by Steven J. Edwards in 1993 (the standard document is dated March 1994). A PGN game has two parts: tags in square brackets (players, event, date, result) and the moves in standard algebraic notation. Files end in .pgn and can hold one game or thousands.
A PGN example, line by line
Here is a complete PGN of one of the most famous games ever played: Paul Morphy's "Opera Game" from Paris, 1858. You can copy this text into any chess program.
[Event "Paris"] [Site "Paris FRA"] [Date "1858.??.??"] [Round "?"] [White "Paul Morphy"] [Black "Duke Karl / Count Isouard"] [Result "1-0"] 1. e4 e5 2. Nf3 d6 3. d4 Bg4 4. dxe5 Bxf3 5. Qxf3 dxe5 6. Bc4 Nf6 7. Qb3 Qe7 8. Nc3 c6 9. Bg5 b5 10. Nxb5 cxb5 11. Bxb5+ Nbd7 12. O-O-O Rd8 13. Rxd7 Rxd7 14. Rd1 Qe6 15. Bxd7+ Nxd7 16. Qb8+ Nxb8 17. Rd8# 1-0
- The tag section (lines in square brackets) describes the game. Each tag is a name and a value in double quotes.
- An empty line separates the tags from the moves.
- The movetext lists the moves with move numbers: 1. e4 e5 means White played e4 and Black answered e5.
- The result is written again at the very end of the moves.
Stockfish 19commentaryA PGN example, line by line: moves and commentary as text
1.e4 White puts a pawn on e4 and claims space in the centre.
1...e5 The movetext lists the moves with move numbers: 1. e4 e5 means White played e4 and Black answered e5.
2.Nf3 White develops the knight to f3.
2...d6 This is the Philidor Defence. Black plays the d-pawn to d6 to fight for the centre.
3.d4 White puts a pawn on d4 and claims space in the centre.
3.Bc4 White develops the bishop to c4.
3...Bg4 Black develops the bishop to g4. It pins the knight on f3 to the queen behind it.
4.Nc3 White develops the knight to c3.
4...Nf6 Black develops the knight to f6.
4...g6 Variations (other possible moves) go in round brackets, right after the move they replace: 4. Stockfish: White is clearly better (+1.9).
5.d3 White plays the d-pawn to d3 to fight for the centre. Stockfish calls the position equal (+0.3).
3...Bg4 Black develops the bishop to g4. It pins the knight on f3 to the queen behind it.
4.dxe5 White takes on e5 with the d-pawn.
4...Bxf3 The bishop takes the knight on f3. Black threatens to take the queen on d1.
5.Qxf3 White takes back on f3 with the queen.
5...dxe5 Black takes on e5 with the d-pawn.
6.Bc4 White develops the bishop to c4. White threatens mate with the queen on f7.
6...Nf6 Black develops the knight to f6.
7.Qb3 The queen goes to b3.
7...Qe7 The queen comes out to e7.
8.Nc3 White develops the knight to c3.
8...c6 Black pushes the c-pawn to c6.
9.Bg5 White develops the bishop to g5. It pins the knight on f6 to the queen behind it.
9...b5 Black pushes the b-pawn to b5. It attacks the bishop on c4.
10.Nxb5 The knight takes the pawn on b5.
10...cxb5 Black takes back on b5 with the pawn. Black threatens to take the bishop on c4. Not the most accurate: Stockfish prefers Qb4+.
11.Bxb5+ White takes back on b5 with the bishop, with check.
11...Nbd7 Black develops the knight to d7.
12.O-O-O White castles queenside: the king goes to c1 and the rook lands on the d-file.
12...Rd8 The rook takes the open d-file.
13.Rxd7 The rook takes the knight on d7. White threatens to take the queen on e7.
13...Rxd7 Black takes back on d7 with the rook.
14.Rd1 The rook takes the open d-file.
14...Qe6 The queen goes to e6.
15.Bxd7+ The bishop takes the rook on d7. It is a fork: check to the king and an attack on the queen on e6. A mistake: Bxf6 was stronger.
15...Nxd7 Black takes back on d7 with the knight. Black threatens to take the queen on b3. A blunder.
16.Qb8+ The queen goes to b8, with check.
16...Nxb8 The knight takes the queen on b8, winning material for now.
17.Rd8# This is the position at the end of the PGN above. A program reads the moves one by one from the starting position and arrives here.
How the moves and results are written
The moves use Standard Algebraic Notation (SAN), the same notation you see in books: a capital letter for the piece (K, Q, R, B, N; no letter for pawns), then the target square. x marks a capture, + a check, # checkmate, O-O and O-O-O castling (with the capital letter O), and =Q a promotion. New to notation? Read our chess notation guide first.
| Result token | Meaning |
|---|---|
| 1-0 | White won |
| 0-1 | Black won |
| 1/2-1/2 | Draw |
| * | Game not finished, or result unknown |
PGN and FEN: what is the difference?
PGN stores a whole game. FEN (Forsyth-Edwards Notation) stores one single position in one line of text. A FEN has six parts, separated by spaces: the pieces rank by rank, whose turn it is, castling rights, the en passant square, the half-move clock and the move number.
The starting position in FEN is:
[Event "FEN example: the starting position"] [Site "?"] [Date "????.??.??"] [Round "-"] [White "?"] [Black "?"] [Result "*"] [SetUp "1"] [FEN "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"] *
When a game does not start from the normal position (a puzzle, an endgame study or a Chess960 game), the PGN includes the tags [SetUp "1"] and [FEN "..."] so that programs know where to begin.
| PGN | FEN | |
|---|---|---|
| Stores | A whole game (or many) | One position |
| Length | Many lines | One line |
| Contains | Tags, moves, comments, result | Pieces, turn, castling, en passant, counters |
| Use it for | Saving and sharing games | Sharing a puzzle or a position to analyse |
How to download the PGN of your games
From Chess.com
- Open the finished game.
- Click the Share button and choose the PGN tab.
- Copy the text, or download it as a .pgn file.
To download many games at once, Chess.com has a free public API that returns a month of games as one PGN file, at an address like api.chess.com/pub/player/USERNAME/games/2026/10/pgn.
From Lichess
- Open the game.
- Open Share & export (or the FEN & PGN panel under the board).
- Copy the PGN or download it.
Lichess also lets you download all your games as one PGN file through its API: lichess.org/api/games/user/USERNAME.
Menu names on other sites can change; look for "Share", "Export" or "Download PGN". Both API addresses were tested on 15 October 2026 and returned PGN files.
How to open and import a PGN file
A PGN file is plain text, so you can open it in any text editor. To replay and analyse it, load it into a chess program. On Rama Chess:
- Open the free Rama Chess analysis board.
- Tap the ⋮ menu above the board and choose Paste PGN / FEN.
- Paste your game and press Load. Step through the moves with the arrows (or the A and D keys on a keyboard).
- Press Analyse to start Stockfish 19, or open Review for a full game review with move marks and accuracy.
- For a file with many games, use All Games PGN → Import games and pick the .pgn file, then open any game from the list.
Want to go further? Our step-by-step guide shows how to review your chess games with the analyser.
Share a game as a link
The Rama Chess analyser can also open a game straight from a link: the PGN is placed after a # in the address, like the buttons on this page. That is an easy way to send a game to a friend or a coach.
How to export (save) a PGN
After you analyse a game, you usually want to keep your notes. In the Rama Chess analyser, open the ⋮ menu and choose Copy PGN: you get the game with your variations and comments as PGN text, ready to paste into a file, a chat or another program. Under Game Details you can fill in the players, result, date and event, which become the PGN tags.
Common PGN problems and how to fix them
| Problem | Fix |
|---|---|
| The game stops loading at one move | That move is illegal, mistyped or ambiguous. For example, if both knights can reach d2, the move must say which one: Nbd2 or Nfd2. |
| Castling written with zeros (0-0) | The standard uses the capital letter O: O-O. Many programs accept both, some do not. |
| Curly quotes in tags (“ ”) | Tags need straight double quotes ("). Word processors often change them. |
| Game starts from a special position | Add [SetUp "1"] and a [FEN "..."] tag. |
| Several games run together | Leave an empty line between one game's result and the next game's tags. |
A short history of PGN
Before PGN, every chess program used its own file format, and games could not easily move from one program to another. In 1993 the American programmer Steven J. Edwards designed PGN and shared it through the Usenet newsgroup rec.games.chess. The standard document, "Portable Game Notation Specification and Implementation Guide", is dated 12 March 1994. It is still the format every major chess site and database uses today. Edwards also defined the extended FEN used in PGN files.
Frequently asked questions
What does PGN mean in chess?
PGN means Portable Game Notation. It is a plain-text format for recording chess games: tags with information about the game, then the moves in algebraic notation, then the result.
How do I open a PGN file?
Open it in any chess program or online analysis board. On Rama Chess, open the analyser, choose Paste PGN / FEN from the menu (or Import games for a file with many games), and load it. You can also read it in a plain text editor.
Who invented PGN?
Steven J. Edwards designed PGN in 1993. The specification document is dated 12 March 1994.
What are the seven required PGN tags?
Event, Site, Date, Round, White, Black and Result, in that order. This is called the Seven Tag Roster.
What is the difference between PGN and FEN?
PGN stores a whole game (moves, tags, comments). FEN stores a single position in one line. A PGN can include a FEN tag when the game starts from a special position.
Can a PGN file contain more than one game?
Yes. A PGN file can hold one game or thousands of games, one after another, separated by empty lines. Game databases are often shared as one large PGN file.
How do I get the PGN of my Chess.com or Lichess game?
Open the game, use the Share (Chess.com) or Share & export (Lichess) option and copy or download the PGN. Both sites also offer free APIs to download all your games as PGN.
Sources and checks
- PGN specification, "Portable Game Notation Specification and Implementation Guide", revised 1994.03.12 (Steven J. Edwards, coordinator).
- Wikipedia, "Portable Game Notation" (cross-check for the 1993 date and the tags).
- Chess.com public API and Lichess API: tested by Rama Chess on 15 October 2026.
- Every PGN on this page was read with the python-chess library to make sure it is valid and every move is legal.
Keep learning on Rama Chess
Watch on YouTube
Prefer video? Our channels show real games move by move, with clear explanations.
Practise it for real: play against Stockfish 19 in your browser, with hints and a full Game Review.
Play the chess bots from this article on Rama Chess: Paul Morphy (free), Adolf Anderssen (free).

Comments, variations and annotation symbols
PGN can store a whole annotated game, not just the moves:
Here is a short annotated PGN with all three: a comment, a variation and NAGs. It is the famous trap called Legal's Mate.
[Event "Legal's Mate (example)"] [Site "?"] [Date "????.??.??"] [Round "-"] [White "White"] [Black "Black"] [Result "1-0"] 1. e4 e5 2. Nf3 d6 3. Bc4 Bg4 4. Nc3 g6 $2 (4... Nf6 {develops and is fine}) 5. Nxe5 $3 Bxd1 $4 {Black takes the queen, but it is a trap.} 6. Bxf7+ Ke7 7. Nd5# 1-0Open the annotated PGN in the analyser