Chessalyzer

Welcome

Batch-analyze chess PGN files and turn game data into statistics and heatmaps.

Chessalyzer is a JavaScript library that reads chess games from PGN files and collects exactly the statistics you care about — for a handful of games or for millions of them.

You tell it what to measure by attaching small building blocks called Trackers (count results, watch what happens on each square, or invent your own statistic). Chessalyzer takes care of the boring parts: reading the file, understanding the moves, and adding everything up. When it's done, you simply read the results off your trackers.

import { analyzePGN } from 'chessalyzer';
import { gameTracker } from 'chessalyzer/trackers';

const games = gameTracker();

await analyzePGN('games.pgn', { trackers: [games] });

games.state.results; // { white: 1, black: 1, draw: 1 }

What you can do with it

  • Answer questions about your games. How often does each opening appear? Who wins more on this square? Where do pieces get captured? If you can phrase it, a tracker can count it.
  • Draw heatmaps. Turn any tracker into square-by-square values and preview them right in your terminal, or feed the data into your own charts.
  • Go big. Chessalyzer is built for huge database exports: it streams files instead of loading them whole and uses all your CPU cores by default.
  • Just parse. Only need the games themselves? The PGN parser gives you structured game data without any analysis.

Where to next

On this page