Is anyone familiar with any open source chess libraries in any language that can do any of the following:

  • parse PGNs and/or FENs
  • calculate valid chess moves based on position
  • process an entire chess game


Sorry, I should be more clear. I'm not looking for open source software, I'm looking for open source programming libraries.

3 Answers 3



Stockfish (website and github) is an open source and very strong UCI engine. As such it can do all you are asking for, but usually requires a GUI in order to do so. You can however access all functionality via a command prompt/shell as well.



Crafty is a strong chess programm and can be used with Winboard, Xboard and Scid. So it is available for all major operating systems.


Scid can maintain databases of chess games, you can analyse (end) games.The software is available for all major operating systems.


Xboard is a user interface to the Internet Chess Server. It uses the X Windows System, so I assume this runs only under GNU/Linux. Xboard can be used as a viewer and supports all forms of chess.



Is a chess client built in Python. You can use it's chess logic libraries without much trouble.

Are examples of how you you might use the libraries to control chess engines, but you can also use just the chess logic:

from pychess.Utils.Board import Board
from pychess.Utils.lutils.lmove import toSAN
from pychess.Utils.lutils.lmovegen import genAllMoves
board = Board(setup=True).board
for move in genAllMoves (board):
    print (toSAN (board, move)))

It's very fast, since it's used for the built in engine, and it has many advanced features such as parsing long list of SAN moves, generating check evasions and static exchange evaluation (SEE).

  • Thanks for sharing, looks very interesting. What does the above do? Could a similar snippet import a pgn file from disk and print all the moves in a similar loop? Does it have libraries to export html? Is there documentation that would help with doing similar kind of scripting?
    – Joe
    Feb 8, 2013 at 18:41
  • And checking out the link, it seems like the actual tool does not run on Windows - yet. Do you think the above code would run on Windows in headless mode though?
    – Joe
    Feb 8, 2013 at 18:43
  • 2
    The above code prints out all possible moves for white in the default position, using Standard Algebraic Notation. Parsing moves is also easy with the same couple of modules. If your project were GPL, I would just copy out the entire lutils module, which is pure Python and doesn't require any Linux specific process handling. Feb 8, 2013 at 23:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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