CQL Introduction

Chess Query Language (CQL) was designed to allow researchers, authors, and players to search for games, problems, and studies that match specific themes.

You specify the theme you are looking for and the database to look for them, in CQL.

Then you run this CQL file using cql.exe .

This creates a new PGN file that has all the games matching your theme.

CQL specifies a small but powerful set of primitives to define chess themes. CQL can find much more complex themes than any other chess program.

Users have searched for themes like stalemates with multiple pins; games in which the same position recurs but with the winning side missing just one piece;

Nowotny and Grimshaw themes, games with some number of captures on a single square, games with a certain number of black and white passed pawns, and many more.


Here you can download the older version 3.02 CQL.zip file for free.

And also on Wikipedia.

References for good introductions to CQL are:

  1. The article by Tim Krabbé in his Open Chess Diary.
  2. Gady Costeff's article in EG #151.
  3. Scidb is a Chess Information Data Base and has CQL implemented with extensions.
  4. Chess Assistent uses CQL and here is their tutorial.
  5. Chess Programming Wiki.


CQL was developed by Gady Costeff and Lewis Stiller.

It is Copyright (c) 2003-2004 and is free.

It also uses Scid code by Shane Hudson.

The Windows build uses the Cygwin Libraries.