Dataset Viewer
The dataset viewer is not available for this dataset.
Unexpected token '<', "<html> <h"... is not valid JSON

Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.

Lichess Standard Rated Games, 2013-01 → 2026-05 (binary move encoding)

A compact binary re-encoding of the Lichess monthly database for standard rated games, covering 161 consecutive months (January 2013 through May 2026) — the full Lichess standard archive at time of publication. Designed for training sequence models on chess games — every move is one 16-bit token, every game is a variable-length sequence of tokens, and per-game metadata lives in Parquet alongside.

Source PGNs were processed with the encoder at https://github.com/Alfredvc/chess-autocomplete (see rust/src/move_codec.rs for the authoritative codec implementation).

Dataset at a glance

Coverage 161 months, 2013-012026-05
Total games 7,863,012,339 (~7.86 billion)
Total positions 520,788,632,891 (~520.8 billion plies / move decisions)
Move tokens (incl. game-end markers) 528,651,645,230
Files 483 (3 per month)
Total dataset size ~1.17 TB (1,173,885,174,888 bytes)
  • moves (*.bin) ~1.06 TB
  • game offset maps (*-map.bin) ~63 GB
  • metadata (*-metadata.parquet) ~54 GB

Size vs. the raw Lichess source (same 161 months): the source PGN is 2.49 TB compressed (.pgn.zst, per the Lichess database totals) and an estimated ~17 TB uncompressed. This binary encoding (~1.17 TB) is therefore about 2× smaller than the compressed source and roughly 14× smaller than the uncompressed PGN. The uncompressed figure is an estimate — scaled from the September 2025 dump (28.3 GB compressed → ~189 GB uncompressed, a 6.7× ratio); the compressed figure is exact.

A "position" above is one ply — a single side-to-move decision — so the position count equals the number of move tokens excluding the one game-end marker per game.

File layout

Per month, three files share the prefix lichess_db_standard_rated_YYYY-MM:

File Format Purpose
*.bin Packed little-endian u16 tokens Concatenated games. One game = one variable-length run of u16 move tokens. No in-stream delimiters — use the map file to find game boundaries.
*-map.bin Packed little-endian u64 Cumulative byte offsets, one per game. Game i occupies bytes [offsets[i-1], offsets[i]) in *.bin (with offsets[-1] = 0). Number of games = len(map) / 8.
*-metadata.parquet Parquet One row per game, in the same order as games appear in *.bin.

All months together: 483 files, ~1.17 TB. The 161 Parquet files alone are ~54 GB and can be browsed directly on the Hub's Datasets viewer via the metadata config.

Metadata schema

Column Type Notes
GameIndex uint64 1-based index within the source PGN file. Skipped games (non-standard start positions, etc.) leave gaps.
WhiteRating/16 uint8 Rating quantized to 16-pt buckets — multiply by 16 to recover. 0 = unknown. Saturates at 4080+ (255 × 16).
BlackRating/16 uint8 Same encoding as WhiteRating.
InitialTime uint16 Initial clock in seconds. 0 = unknown.
Increment uint8 Increment in seconds.

Move token encoding (16 bits per move)

Each u16, parsed in little-endian byte order, packs five fields:

bits 15-12 : op       (4 bits — piece, castle, promotion, or game-end marker)
bits 11-9  : from_file (3 bits, 0=a … 7=h)
bits  8-6  : from_rank (3 bits, 0=rank 1 … 7=rank 8)
bits  5-3  : to_file   (3 bits)
bits  2-0  : to_rank   (3 bits)

op codes:

Code Meaning
0b0000 Pawn move
0b0001 Knight move
0b0010 Bishop move
0b0011 Rook move
0b0100 Queen move
0b0101 King move (non-castle)
0b0110 White king-side castle
0b0111 White queen-side castle
0b1000 Game-end marker (see special tokens below)
0b1001 Promotion to knight
0b1010 Promotion to bishop
0b1011 Promotion to rook
0b1100 Promotion to queen
0b1101 Black king-side castle
0b1110 Black queen-side castle
0b1111 Reserved / unused

When op == 0b1000, the lower 12 bits encode the termination reason rather than squares:

Token Reason
0x8000 Unknown
0x8001 Checkmate
0x8002 Stalemate
0x8003 Insufficient material
0x8004 Fifty-move rule
0x8005 Threefold repetition

Each game's token stream terminates with one of these markers. This representation is board-free: a parser does not need to maintain a chess position to decode any single move (unlike SAN or UCI), since the moving piece type, origin square, destination square, and promotion piece are all explicit.

Decoding example (Python)

Reading game i from a single month:

import numpy as np
import pyarrow.parquet as pq

month = "2024-01"
prefix = f"lichess_db_standard_rated_{month}"

# Per-game byte offsets into *.bin (cumulative end positions)
offsets = np.fromfile(f"{prefix}-map.bin", dtype=np.uint64)
num_games = len(offsets)

# Memory-map the moves
moves = np.memmap(f"{prefix}.bin", dtype=np.uint16, mode="r")

def get_game_tokens(i: int) -> np.ndarray:
    start_byte = 0 if i == 0 else offsets[i - 1]
    end_byte = offsets[i]
    # offsets are byte positions; tokens are 2 bytes each
    return moves[start_byte // 2 : end_byte // 2]

# Per-game metadata aligns row-for-row with the games in *.bin
meta = pq.read_table(f"{prefix}-metadata.parquet").to_pandas()
print(meta.iloc[0])
print(get_game_tokens(0))

To decode an individual move token:

def decode(token: int):
    op = (token >> 12) & 0xF
    if op == 0b1000:
        return ("game_end", token & 0xFFF)
    from_file = (token >> 9) & 0x7
    from_rank = (token >> 6) & 0x7
    to_file   = (token >> 3) & 0x7
    to_rank   =  token       & 0x7
    return (op, from_file, from_rank, to_file, to_rank)

Coverage

161 months, one set of files per month: 2013-01, 2013-02, …, 2025-12, 2026-01, …, 2026-05.

Per-month size varies by two orders of magnitude — from 2013-01 (121,332 games, a 16 MB .bin) to recent months around 90–100M games (12 GB .bin) — so download only the months you need (see filtering below). Games with non-standard starting positions (e.g., Chess960 mixed into the standard archive, or unusual FEN tags) are skipped during encoding, so GameIndex is not contiguous; only 7 such games are skipped across the entire archive.

Filtering / partial downloads

Use huggingface_hub's filtered download to pull only the months or file types you need:

from huggingface_hub import snapshot_download

# Just the metadata Parquet files (~54 GB total)
snapshot_download(
    repo_id="Alfredvc/chess-autocomplete-lichess",
    repo_type="dataset",
    allow_patterns="*-metadata.parquet",
    local_dir="./lichess",
)

# A single month, all three files
snapshot_download(
    repo_id="Alfredvc/chess-autocomplete-lichess",
    repo_type="dataset",
    allow_patterns="lichess_db_standard_rated_2024-01*",
    local_dir="./lichess",
)

License

The underlying Lichess game data is published by Lichess under CC0 1.0 (public domain dedication). This re-encoded copy is released under the same terms. Please cite the Lichess database when using this dataset.

Downloads last month
893