Portable Game Notation (PGN)

A standard format for recording chess games in text form, widely used in databases and chess software.

Introduction
Portable Game Notation (PGN) is the standard format for recording chess games, allowing players to save, share, and analyze their games easily. Developed in 1993 by Steven J. Edwards, PGN is widely used in chess databases, online platforms, and engines to store move sequences and metadata.

What does a PGN file look like? How do chess engines and websites use it? And why is PGN essential for every chess player? This article explores the structure, uses, and benefits of PGN notation.

1. What Is PGN?

PGN is a text-based format that records a chess game’s moves, player names, event details, and other metadata. It allows for easy game storage, transmission, and replay across different chess software and platforms.

Example of a basic PGN file (starting position to Scholar’s Mate):

[Event « Casual Game »]
[Site « Online »]
[Date « 2024.02.09 »]
[White « Player1 »]
[Black « Player2 »]
[Result « 1-0 »]

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

This PGN file contains all the information needed to reconstruct the game.

2. Structure of a PGN File

A PGN file consists of two main parts:

  1. Header (Metadata): Information about the game.
  2. Movelist: The actual sequence of moves.

2.1 The PGN Header (Metadata)

The header contains key details about the game, enclosed in brackets [ ].

Common PGN header tags:

  • [Event "Tournament Name"] → Name of the tournament or match.
  • [Site "Location"] → Where the game was played.
  • [Date "YYYY.MM.DD"] → Date of the game.
  • [Round "1"] → Round number.
  • [White "Magnus Carlsen"] → Name of the player with White.
  • [Black "Hikaru Nakamura"] → Name of the player with Black.
  • [Result "1-0"] → Final result of the game:
  • "1-0" → White wins.
  • "0-1" → Black wins.
  • "1/2-1/2" → Draw.

Example of a complete PGN header:

[Event « World Chess Championship »]
[Site « Dubai, UAE »]
[Date « 2021.12.10 »]
[Round « 6 »]
[White « Magnus Carlsen »]
[Black « Ian Nepomniachtchi »]
[Result « 1-0 »]

This tells us that Carlsen played White, Nepomniachtchi played Black, and Carlsen won.

2.2 The Movelist (Chess Moves)

  • Moves are written in standard algebraic notation (SAN).
  • Each move pair is numbered:
  • 1. e4 e5 → White plays e4, Black plays e5.
  • 2. Nf3 Nc6 → White plays Nf3, Black plays Nc6.
  • Check is indicated by +, and checkmate by #.

Example PGN movelist:

  1. d4 d5 2. c4 e6 3. Nc3 Nf6

This records the Queen’s Gambit Declined opening.

3. Special PGN Notations

3.1 Castling

  • Kingside castling: O-O
  • Queenside castling: O-O-O

Example:

  1. e4 e5 2. Nf3 Nc6 3. Bb5 a6 4. O-O

White castles kingside on move 4.

3.2 En Passant

  • Capturing en passant is recorded normally.

Example:

  1. e4 e5 2. d4 exd4 3. c3 dxc3 e.p.

Black captures c3 en passant.

3.3 Pawn Promotion

  • If a pawn promotes, it is written as e8=Q.

Example:

  1. e4 e5 2. e7 e8=Q

White promotes e7 to a queen.

3.4 Game Annotations

  • « ! » = Good move
  • « !! » = Brilliant move
  • « ? » = Mistake
  • « ?? » = Blunder
  • « !? » = Interesting move
  • « ?? » = Dubious move

Example PGN with annotations:

  1. e4 e5 2. Nf3 Nc6 3. Bb5 a6?! 4. Ba4 Nf6?

This means:

  • a6?! → Slightly dubious move.
  • Nf6? → A mistake.

4. Why PGN Is Important

4.1 Used by Chess Engines and Databases

  • Chess programs like Stockfish, ChessBase, and Lichess use PGN to analyze games.
  • PGN files allow players to store and revisit their games for improvement.

4.2 Sharing and Learning from Games

  • Players can download PGNs of famous games to study openings and strategies.
  • PGN allows online chess sites to broadcast live games.

4.3 Easy to Edit and Read

  • PGN is a simple text format, meaning it can be edited and modified manually.
  • Even without a chess engine, a PGN can be read and reconstructed.

5. How to Use PGN in Chess Software

5.1 Importing PGN

  • Lichess → Copy and paste PGN into « Analysis Board ».
  • Chess.com → Upload PGN in the « Game Explorer ».
  • ChessBase → Open PGN files for deep analysis.

5.2 Exporting PGN

  • Most chess websites allow you to download your game as a PGN file.
  • You can save PGNs to track your progress over time.

6. Conclusion

PGN is the universal format for storing and sharing chess games. Whether you’re a beginner saving your online games, a coach analyzing student games, or a grandmaster preparing an opening repertoire, understanding PGN will help you organize and study chess effectively.

PGN records game metadata and moves in a structured format.
Chess engines, websites, and databases rely on PGN for game storage and analysis.
Knowing how to read and edit PGN helps players analyze and improve their games.

If you want to improve at chess, learning how to use PGN files is an essential skill that will help you store, share, and study games like a professional!

Be better at chess.

  • Manage & Learn chess database
  • Upload / Export / Merge .PGN files
  • Visualize chess in move tree format
  • FREE online chess tool
Get startedDiscover App