How to Analyze PGN Files: A Step-by-Step Tutorial
Portable Game Notation (PGN) is the standard text format for recording chess games. Whether you are downloading your games from online platforms, exporting files from tournament databases, or downloading grandmaster games, you will work with PGN files.
However, a raw PGN is simply a text file. To study the games, you need a reader that parses the notation, displays the board, and connects with an engine to analyze the moves.
This tutorial explains how to analyze PGN files using free offline chess software.
Understanding the PGN File Format
A standard PGN file contains two main sections:
- Tag Pairs (Metadata): Enclosed in square brackets, these lines record details about the game, such as the event name, date, player names, and results.
- Move Text: The list of moves written in algebraic notation, sometimes including annotations (like
?for mistakes) or sub-variations in parentheses.
Here is an example of a simple PGN:
[Event "Club Tournament"]
[Site "Local Database"]
[Date "2026.06.14"]
[White "Player A"]
[Black "Player B"]
[Result "1-0"]
1. e4 e5 2. Nf3 Nc6 3. Bc4 Nf6 4. Ng5 d5 5. exd5 Nxd5 6. Nxf7 Kxf7 7. Qf3+ Ke6 8. Nc3 1-0
Step-by-Step Analysis Guide
1. Export Your PGN File
You can obtain PGN files from any chess playing platform:
- Chess.com: Open a completed game, click the Share button, navigate to the Download tab, and copy the PGN text or save the file.
- Lichess: Open a game, click the Share & Export tab below the board, and download the PGN.
2. Open Your PGN Viewer
To view and analyze the PGN, you need a desktop GUI. We will use Chess Analyzer Pro as a simple, polished companion tool for local analysis.
- Download and install Chess Analyzer Pro from the Releases Page.
- Launch the application.
- If you haven't already, configure your Stockfish engine path under Settings > Chess Engine (you can download the free Stockfish engine from stockfishchess.org).
3. Load the PGN into Chess Analyzer Pro
Open the Load Game dialog in the app. You have three ways to import the game:
- PGN File: Drag and drop your
.pgnfile directly into the import area, or browse your files to load it. - PGN Text: Paste the raw PGN text from your clipboard into the text box and click Parse PGN.
- Direct API Fetch: If you played the game online, you can select the Chess.com or Lichess tabs, enter your username, and fetch recent games directly using public APIs.
4. Run the Engine Analysis
Once the game is loaded:
- Click the Analyze Game button in the sidebar.
- Configure your desired depth (e.g., Depth 18-20 is standard for a quick blunder check).
- Click Start. The progress bar will track the engine as it evaluates each move.
- Once completed, the move list will display color-coded move classifications (e.g., green checkmark for best moves, red markers for blunders) alongside the evaluation graph.
5. Check Engine Lines and Variations
- Use your keyboard Arrow Keys (Left/Right) to step through the moves.
- The analysis panel displays the top 3 engine lines for each position, showing what variations the engine recommends.
- Make moves on the board to explore alternative variations. The engine will calculate new lines on the fly, allowing you to see how Stockfish refutes mistakes.
- If you have configured a free Groq API key in settings, you can check the AI Summary tab to read a plain-English review of the game's turning points.
Batch Processing Multiple PGN Files
If you have a folder of PGN files — for example, all your games from a monthly tournament — you do not need to load them one by one. Chess Analyzer Pro supports batch import:
- In the Load Game dialog, select Import Folder as the source.
- Browse to the folder containing your
.pgnfiles. The app will scan for all valid PGN files and load them into the game list. - Click Analyze All to run the engine sequentially across every loaded game. You can walk away while the app processes the batch.
- Once finished, each game appears in your local SQLite database with completed analysis. Filter by date, opponent, event, or result to find specific games later.
Batch processing tips:
- For large batches (50+ games), lower the analysis depth to 16 to speed things up. You can re-analyze individual games later at higher depth.
- Ensure your laptop is plugged in. Batch analysis is CPU-intensive and will drain a battery quickly.
- If you have a multi-core CPU, Chess Analyzer Pro runs analysis on a separate thread so the GUI stays responsive. You can browse completed games while others are still being analyzed.
Merging and Managing PGN Databases
Over time, you will collect PGN files from multiple sources: online accounts, tournament organizers, club databases, and downloaded grandmaster games. Merging them into a single organized database makes searching much easier.
How to merge PGN files manually:
Since PGN is a text format, you can concatenate multiple .pgn files into one. On the command line:
cat games1.pgn games2.pgn games3.pgn > merged.pgn
Each game in a PGN file is separated by a blank line. The merged file should contain all games in sequence.
How to merge PGN files with Chess Analyzer Pro:
- Load each PGN file using the Load Game dialog. Each game gets added to the in-app game list.
- Use the Export feature to save all loaded games into a single PGN file.
- The export preserves all existing tags and adds Stockfish evaluation comments as NAGs (Numeric Annotation Glyphs) and inline comments.
Organizational best practices:
- Use consistent naming:
games-2026-monthly.pgninstead ofgames.pgn. - Keep separate files for correspondence, blitz, and classical time controls.
- Add custom tags if your GUI supports it. Chess Analyzer Pro lets you edit game metadata before saving.
PGN Validation and Error Checking
Not all PGN files are well-formed. Some common problems include missing tags, illegal move sequences, and encoding issues. Here is how to catch and fix them.
Common PGN Errors
| Error | Symptom | Fix |
|---|---|---|
| Missing Seven Tag Roster | Game has no Event, Site, Date, Round, White, Black, or Result tags | Manually add them. PGN standards require all seven. Chess Analyzer Pro will auto-fill missing tags with default values. |
| Illegal move notation | A move like Qh5 cannot be parsed | The position might not have a queen on that file, or the move is ambiguous. Check the board state by stepping through prior moves. |
| Corrupted NAG codes | $1 or $2 symbols appear in the move text instead of ! or ? | These are valid but some viewers render them as raw codes. Chess Analyzer Pro displays them as proper icons. |
| Duplicate tags | Two [Round "1"] lines in the same game | Remove the duplicate. The PGN standard specifies that each tag should appear at most once. |
| Incorrect result tag | [Result "*"] for a finished game | Replace with 1-0, 0-1, or 1/2-1/2 as appropriate. * means the game is unfinished. |
| UTF-8 BOM characters | Strange symbols at the start of the file | The file has a byte order mark. Most PGN parsers handle this, but if yours does not, save the file as UTF-8 without BOM. |
| Extra whitespace or blank lines | The parser shows no games found | Ensure there is exactly one blank line between different games. Multiple blank lines can confuse some parsers. |
Using External Validation Tools
For large PGN collections, consider using pgn-extract — a command-line tool that validates, filters, and transforms PGN files.
# Validate all games in a file and report errors
pgn-extract --notags --checkvalidity games.pgn
# Extract only games where White won
pgn-extract --tagfilter "Result:1-0" games.pgn
# Remove duplicate games
pgn-extract --duplicate games.pgn
Chess Analyzer Pro runs a lightweight validation on import. If a PGN file contains syntax errors, the app highlights the problematic game so you can fix it before analysis.
Exporting Analyzed Games with Engine Annotations
Once you have run Stockfish analysis on your games, you can export the annotated results for sharing, printing, or archiving.
Chess Analyzer Pro export options:
-
Annotated PGN with Engine Lines: Exports the game with Stockfish's best lines added as comments. Each critical move includes the engine's evaluation in centipawns and the top variation. This PGN is compatible with any standard chess GUI (Arena, Scid, ChessBase, Lichess study import).
-
PDF Report: Generates a formatted document with the evaluation graph, move-by-move classification table, and optional AI summary. Useful for printing or sending to a coach.
-
CSV Summary: Exports a spreadsheet-compatible file with one row per move. Columns include move number, white/black move, evaluation before/after, classification (best/brilliant/mistake/blunder), and centipawn loss. Great for data analysis and tracking performance over time.
-
AI Summary (Plain Text): If you have configured a Groq API key, you can export just the natural-language summary of the game. This is a coach-friendly format you can paste into email or a shared document.
Sharing analyzed games with a coach:
- Export the annotated PGN and your coach can import it into their own analysis software.
- The PDF report works well as a pre-lesson handout — your coach can see the evaluation graph and move list before you meet.
- The AI summary serves as a starting point for discussion. Coaches often use it to spot which turning points a student might have missed.
Beyond Single Games: Analyzing PGN Databases for Trends
If you have hundreds or thousands of games in PGN format, you can analyze them collectively to find patterns in your play.
Opening performance analysis: Export your games from the last 6 months, batch import them into Chess Analyzer Pro, and analyze the batch. Then look at the CSV export to answer questions like:
- Which openings do I score best in?
- Do I lose more games when I play a particular response to 1. d4?
- Am I blundering more in the middle game or the end game?
Rating-level benchmarks: Compare your accuracy scores against opponents at different rating levels. If you score 92% accuracy against 1400-rated opponents but only 78% against 1800-rated opponents, the CSV per-move data can show where the quality drops off — is it in the opening, the tactical middle game, or the endgame technique?
Opening repertoire maintenance: Every 3-6 months, run analysis on your recent games and check whether your opening moves are consistently achieving good evaluations. If Stockfish consistently suggests better alternatives in a particular variation, it may be time to update your preparation.
Common PGN Pitfalls and How to Avoid Them
PGN with Embedded Unicode Characters
Some PGN files contain player names with accented characters or non-Latin scripts. Standard PGN specifies ASCII for tag values, but many modern sources use UTF-8. Chess Analyzer Pro handles UTF-8 tags, but legacy GUIs may show garbled text. If compatibility matters, strip diacritics before exporting.
Very Large PGN Files
A PGN file containing 10,000 games can be 50-100 MB. Loading this into any GUI takes time. Use external tools to split the file by date range, player name, or event before importing. The command-line pgn-extract tool can filter by any tag value:
pgn-extract --tagfilter "Event:MyTournament" hugefile.pgn -o filtered.pgn
Games Without Move Timestamps
Many PGNs from tournament databases omit the move time stamps. Without them, Chess Analyzer Pro cannot calculate time pressure stats or per-move thinking time. If this matters, look for PGN sources that include the %clk or [%clk] annotations, which record clock times.
Duplicate Games from Multiple Sources
If you maintain PGN files from both Chess.com and Lichess for the same time period, you may have duplicates. Use pgn-extract --duplicate to remove exact duplicates, or compare by game ID tag. Chess Analyzer Pro's database automatically deduplicates by checking the game result, players, date, and move sequence.
Frequently Asked Questions
Can I analyze PGN files on my phone? Chess Analyzer Pro is a desktop application. For mobile PGN analysis, consider apps like DroidFish (Android) or Chess Studio (iOS). For the full offline experience with Stockfish integration, a laptop or desktop is recommended.
What is the maximum PGN file size Chess Analyzer Pro can handle? The application has been tested with files containing up to 5,000 games. Performance depends on available RAM. For very large databases, split them into smaller files by year or event.
Does Chess Analyzer Pro support PGN with embedded variations? Yes. Games with annotated variations (enclosed in parentheses) are parsed correctly, and the engine evaluates both the main line and sub-variations during analysis.
Can I import games directly from an external hard drive? Yes. Chess Analyzer Pro reads PGN files from any mounted filesystem. Your SQLite database and cached analysis are stored in the application data directory by default, but you can change this in settings.
For more details on the features discussed here, visit the Features Page. If you need help with a specific PGN issue, check the Docs Page for troubleshooting guides.