A couple of places on the web mention a free utility called pgnsplit, that does the following: "A commandline tool to convert pgn-files including games with variation into pgn-files where each variation get its own game."

Sadly, all links to it seem dead. Does anyone know if it is possible to download it anywhere, or to find similar functionality in any other common chess database software?


Here is the author's page courtesy of archive.org. The zip file on that page includes the readme.

Direct download of the zip file


As of 2017.04.01, pgn-extract (version 17-38) does provide variation splitting functionality via its --splitvariants flag. So, if you want this in a Windows/Linux/Mac OS environment it is available. Disclosure: I am the author of pgn-extract.

  • 3
    Welcome for joining. I've been using your software for long time, and it's great. – SmallChess Apr 1 '17 at 10:03
  • 1
    I am glad you like it. – kentdjb Apr 2 '17 at 11:31
  • thanks, I used it before, good to know about this new feature. – Joe Apr 14 '17 at 21:43

The only one I've found that will probably do what you want is PGN Extract. It's a command line tool, so hopefully you're comfortable with that. It has a Windows binary, but if you need it for Linux or Mac I hope you're comfortable with compiling from source.


It appears PGN Extract will only separate unique games in a single PGN into multiple PGNs, not branches. Sadly PGN Split was one of a kind, and there doesn't appear to be a replacement. One of few programs that managed to disappear completely from the internet.

  • thanks, I used it a long time ago. Does it do what I want out of the box, or are you saying I need to recompile and modify it? – Joe May 3 '13 at 14:23
  • Do you know what command-line options will do what the asker wants? I found PGN Extract when searching for an answer to his question, but couldn't find the feature he's asking for in the documentation. – dfan May 3 '13 at 14:23
  • @Joe From what I saw the option to separate files sounds exactly like what you want. – MDMoore313 May 3 '13 at 14:24
  • @dfan the Separate Output Files (-E) looks likes it's it. – MDMoore313 May 3 '13 at 14:25
  • -E seems to take the specified games and output them to multiple files, rather than to turn one game into many games (one for each variation), which is what @Joe is requesting. – dfan May 3 '13 at 14:40

This will do it.


I built it on mac--works great.

  • Hi Kevin. Can you elaborate a bit please? The community discourages link only answers, as the link might become inactive. It would be great if you could elaborate on how the code meets the criteria of the original poster, maybe a few screenshots of it in action, maybe a little bit about how the code works? – user1108 Mar 23 '16 at 10:08
  • PGN-extract is not the same thing as pgnsplit – Joe Mar 28 '16 at 2:29

I don't understand what you meant by pgn split, but I once purchased a chess pgn book and it has all the games (312) in one pgn file. Now I need to split it into each chapter with exactly 12 games each. I searched over the internet and didn't manage to find anything helpful. So I wrote a python program to divide it into separate files.

import os

name = 'Your pgn file here'
units = 12
test_sub = "[E"
path = 'F:/Chess/pgns/'
file = ''

with open(path+name+'.txt', encoding="utf8") as f:
    test_str = f.read()

# using list comprehension + startswith()
# All occurrences of substring in string 
res = [i for i in range(len(test_str)) if test_str.startswith(test_sub, i)]

print('No of games in each pgn =',units)  
print('Total games found =',len(res))
print('Splitting',len(res),'games into',len(res)//units,'pgns.....')


for i in range(len(res)//units):

    file = path+name+'/'+name+'- Unit-'+str(i+1)+'.pgn'

    if i==len(res)//units-1:
        with open(file, 'w', encoding="utf8") as file:
        with open(file, 'w', encoding="utf8") as file:


Note: This divides the given pgn into equal number of files mentioned as units in the program, it doesn't divide a pgn into separate pgn's based on variations.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.