Education Template

Batch PGN to FEN Converter and Piece / Square Counter

This tool has two primary uses for analyzing chess games. The first is to convert all of the moves from a PGN input into FEN notation, which describes in a shorthand way the placement of all the pieces on the board at a given moment. The code utilizes the same framework as the LT-PGN viewer PGN2FEN tool (which in turn is built upon LT-PGN viewer code), but unlike the original version this page can handle PGN files with multiple games and standard header tags and markup. All of the FEN strings can be returned, in order, as one giant list.

In addition, the FEN code can be reformatted to aid in analysis of piece placement, expanding numbers in the empty spaces they represent. Finally, this tool can produce a count of how many positions have a particular piece on a particular square. This can be utilized to determine the average piece placement in a PGN database.

To use this tool, simply paste your PGN text into the input box below. For best results, the PGN should not have any line-breaks between moves. You can then process the information by clicking the appropriate buttons in sequence. If you have a set of FEN positions or Expanded-FEN positions, you may enter them directly later in the form and click the downstream buttons. Be forewarned; a large PGN file can be processed, but it may take some time to do so. For example, a set of 250 games of average length (30-50 moves) can generate tens of thousands of individual positions.


Start FEN:

Input PGN move text:




Number of Games



Game Scores, Reformatted



FEN Positions, All Games





Expanded FEN



Piece:




Piece Count Per Square