Technology

Open-Source Chess Board Recognition: Image to FEN Projects Compared

7 min read

For screenshots and other 2D boards, fenshot (MIT) is the most practical open-source image-to-FEN recognizer and runs in a browser; for photos of physical boards, ChessLens (MIT) reports 99.3% of squares and 91.8% of whole boards correct with a model small enough for a phone. LiveChess2FEN handles live video but is AGPL-3.0.

We surveyed these projects when building the photo scanner on BestChessMove.xyz, which uses fenshot and a TypeScript port of ChessLens. Chess board recognition has two halves: finding the board and its 64 squares in the image, then classifying the piece on each square. Screenshots make the first half easy, since the board is flat and square; photos of real boards need perspective correction and must cope with pieces that overlap neighbouring squares. Accuracy is usually reported per square, which flatters: 99% of squares still means a wrong square on roughly every other board, so any real product needs a correction step.

The projects

  1. fenshotMIT · TypeScript/npm · screenshots

    A screenshot reader published on npm as @scoriiu/fenshot. It finds the board in JavaScript and classifies each tile with a 1.3 MB ONNX network on onnxruntime-web (WebAssembly), so it runs entirely in the browser. Its evaluation on real screenshots from chess sites reports zero wrong tiles on every board in the set. It is built for flat 2D boards, including straight-on photos of screens, not for physical pieces.

  2. ChessLensMIT · Python + ONNX · physical boards

    Reads photos of real boards. Its board finder locates the saddle points where squares meet and fits the grid with RANSAC in OpenCV, then a 0.84-million-parameter CNN (a 3.4 MB ONNX file) classifies each square. The authors report 99.3% of squares and 91.8% of full boards correct on held-out real photos taken from above, lower at steep angles and on other piece sets. The training data partly comes from a dataset without a license, which matters if you need a clean chain; the training scripts are MIT, so you can retrain.

  3. chesscogMIT · Python · research

    A well-documented research pipeline for physical boards with large ResNeXt and Inception classifiers (around 100 MB or more), trained on rendered boards. A 2023 study by Masouris and van Gemert found that only about 2% of its real-photo boards came out fully correct, so treat it as a starting point for research rather than a ready-made recognizer.

  4. End-to-end chess recognition (ChessReD)MIT · Python · research

    The Masouris and van Gemert project that introduced the ChessReD dataset of real smartphone photos and an end-to-end model that predicts the whole board at once instead of square by square. The paper reports about 15% of real boards fully correct, far ahead of chesscog on the same photos, and the dataset is useful for training or testing your own recognizer.

  5. LiveChess2FENAGPL-3.0 · Python · live video

    Follows a physical game from a camera and outputs each new position as FEN, built to run on an NVIDIA Jetson. Its paper reports 92% piece classification accuracy. The AGPL-3.0 license means that if you serve it as part of a web app, you must publish your app’s source, which rules it out for many products.

  6. tensorflow_chessbotMIT · Python · screenshots

    One of the earliest image-to-FEN projects, a TensorFlow model that read screenshots posted to Reddit. It only handles 2D boards and confuses queens and kings on some Chess.com themes; fenshot does the same job better today. Still a readable introduction to the square-by-square approach.

Frequently asked questions

How do you convert a chessboard image to FEN?
Find the board, split it into 64 squares, classify the piece on each square, then write the ranks from 8 down to 1 as FEN, compressing empty squares into digits. Side to move, castling rights and en passant cannot be seen in a picture, so a person has to add them. To do it without code, use a scanner such as the free one on BestChessMove.xyz.
Which open-source chess recognizer is most accurate on real photos?
Among the projects here, ChessLens reports the best real-photo results: 99.3% of squares and 91.8% of full boards on held-out photos taken from above. Published results on other photo sets, steep angles or unusual piece sets are lower for every project.
Can chess board recognition run in the browser?
Yes. fenshot ships an ONNX model for onnxruntime-web, and ChessLens’s square classifier is a 3.4 MB ONNX file that runs the same way once its OpenCV board finder is ported to JavaScript or TypeScript. That is how BestChessMove.xyz reads images without uploading them.
Can I use YOLO for chess piece detection?
Many hobby projects train YOLO detectors on chess pieces, and they can work well. Check the license first: Ultralytics YOLO is AGPL-3.0, and hosted inference services usually bill per call.
Why not use a general vision AI model to read the board?
Large vision language models can describe a chess photo, but they are still unreliable at naming all 64 squares exactly, and every scan costs money. Small dedicated classifiers are cheaper, faster and more accurate for this one job.