A chess query facility for PGN databases.

Search, filter, and transform millions of games, studies, and puzzles with precision. Built for composers, trainers, researchers, authors, database curators, and chess enthusiasts.

v1.0.7 released Apr 19, 2026 Windows macOS Linux

mate
flipcolor flip { kh8 Nf6 Rh7 }
Board diagram showing a black king on h8 mated by a white rook on h7 defended by a white knight on f6
An Arabian mate found by the query

About 1 in 1,890 lichess games end with this checkmate pattern.

move enpassant : mate
Board diagram where a black pawn captures en passant to deliver checkmate
59...hxg3# — mate by en passant

Finds every position where the next move capturing en passant delivers checkmate — a motif that occurs once in roughly a million games.

not reachableposition
Board diagram of a composition with a starting position proven to be unreachable from the initial chess position
Selman, 1941 — starting position is provably impossible

Proves a position cannot arise from any legal game. Credited with flagging dozens of flawed studies in the HHdbVII endgame database.

What is CQLi?

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 →

Get started in seconds

Native 64-bit binaries, no external dependencies.

Linux

curl -LO https://cql64.com/downloads/cqli-1.0.7-linux.zip
unzip cqli-1.0.7-linux.zip
./cqli -version

macOS

curl -LO https://cql64.com/downloads/cqli-1.0.7-macos.zip
unzip cqli-1.0.7-macos.zip
./cqli -version

Windows

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'

Precise chess database analysis

Pattern search

Express positional ideas directly using piece designators, attacks, rays, and transforms.

Tag & comment editing

Add, remove, or rewrite PGN tags and annotations. Strip clock/eval information, add custom comments, and populate ECO/Opening in bulk.

Variant support

Comprehensive support for popular variants including Chess 960, Crazyhouse, Horde, and Racing Kings.

Puzzle generation

Explore positions beyond the moves actually played. Find missed mates, generate tactics, and solve chess puzzles.

Retrograde analysis

Reverse move generation and unreachable-position detection support retrograde analysis and study verification.

Extensible

Easily connect to external programs using a language-agnostic extensibility mechanism.

Generate and solve various types of chess puzzles

Rook Maze in 17 by J. Coakley, 2006 — a puzzle where a rook navigates a series of squares in the fewest moves
Rook Maze in 17, J. Coakley, 2006
Knight Maze in 29 by J. Coakley, 2020 — a puzzle where a knight navigates a series of squares in the fewest moves
Knight Maze in 29, J. Coakley, 2020

See “Expository Examples” ⇒ “Generating and Solving Chess Problems” ⇒ “Chess Mazes” in the PDF Reference Manual for the solving query.

CQLi finds unreachable positions in compositions

Board diagram of a John Selman 1941 composition whose starting position is provably unreachable from the initial chess position
John Selman, 1/2-1/2, 1941
Why this position is unreachable All of Black’s missing pieces were captured by White Pawns currently on the board, but the missing trapped c8 Bishop could not have been captured by one of these Pawns.

CQLi is credited with discovering unreachable starting positions in dozens of compositions in the HHdbVII endgame study database.