Pattern search
Express positional ideas directly using piece designators, attacks, rays, and transforms.
Search, filter, and transform millions of games, studies, and puzzles with precision. Built for composers, trainers, researchers, authors, database curators, and chess enthusiasts.
mate
flipcolor flip { kh8 Nf6 Rh7 }
About 1 in 1,890 lichess games end with this checkmate pattern.
move enpassant : mate
Finds every position where the next move capturing en passant delivers checkmate — a motif that occurs once in roughly a million games.
not reachablepositionProves a position cannot arise from any legal game. Credited with flagging dozens of flawed studies in the HHdbVII endgame database.
CQLi is a free, BSD-licensed chess database search tool that implements the Chess Query Language (CQL) — a formal query language for finding chess games containing specific themes or motifs, positional patterns, move sequences, and game metadata. It reads standard PGN files and writes matching games to a new PGN file.
CQLi extends CQL 6.1 by adding chess variant support, retrograde analysis, imaginary position exploration, and more. It is fast and runs natively on Windows, macOS, and Linux. Learn more about Chess Query Language →
Native 64-bit binaries, no external dependencies.
curl -LO https://cql64.com/downloads/cqli-1.0.7-linux.zip unzip cqli-1.0.7-linux.zip ./cqli -version
curl -LO https://cql64.com/downloads/cqli-1.0.7-macos.zip unzip cqli-1.0.7-macos.zip ./cqli -version
Invoke-WebRequest https://cql64.com/downloads/cqli-1.0.7-windows.zip -OutFile cqli.zip Expand-Archive cqli.zip .\cqli\cqli.exe -version
Then run your first query:
cqli -i games.pgn -o matches.pgn -cql 'mate and move previous enpassant'
Express positional ideas directly using piece designators, attacks, rays, and transforms.
Add, remove, or rewrite PGN tags and annotations. Strip clock/eval information, add custom comments, and populate ECO/Opening in bulk.
Comprehensive support for popular variants including Chess 960, Crazyhouse, Horde, and Racing Kings.
Explore positions beyond the moves actually played. Find missed mates, generate tactics, and solve chess puzzles.
Reverse move generation and unreachable-position detection support retrograde analysis and study verification.
Easily connect to external programs using a language-agnostic extensibility mechanism.
See “Expository Examples” ⇒ “Generating and Solving Chess Problems” ⇒ “Chess Mazes” in the PDF Reference Manual for the solving query.
CQLi is credited with discovering unreachable starting positions in dozens of compositions in the HHdbVII endgame study database.