Playing chess online with Emacs
Every now and then I like to play a game of chess with my colleagues at the office, without ever leaving my favourite Elisp interpreter. Emacs has a really good package for this, chess, which supports several ways to play: against the machine, over a local network, against internet chess servers (ICS), and even through IRC (I am proud to say I finished implementing that last feature myself). You can check out the official documentation.
:quality(85)/https://andros.dev/media/blog/2026/05/chess_emacs_board.png)
So I would like to share a brief introduction to playing chess over a network from Emacs.
Local network game
Lets you play directly between two Emacs sessions over TCP. You can use it to play with a friend on the same local network or VPN.
Launch it with:
C-u M-x chess RET network RET
On startup it asks which role you want:
- Server: opens a local port and waits for a connection. Uses
open-network-stream-server(ornc -l -pas a fallback if not available). - Client: prompts for a host and port, then connects.
Internet chess servers (ICS)
Maybe you have a favourite online chess provider, or you want to test your skills against players from around the world.
Launch it directly with:
M-x chess-ics
Connects to real ICS servers. The preconfigured ones are:
| Server | Port |
|---|---|
freechess.org |
5000 |
chessclub.com |
5000 |
chess.net |
5000 |
chess.unix-ag.uni-kl.de |
5000 |
oics.olympuschess.com |
5000 |
Supports login with a handle and password.
Playing through IRC
To play over IRC, run:
M-x chess-irc
It will connect to your configured IRC server, then ask for your opponent's nick. Your opponent needs to do the same on their end. No worries about privacy: the game uses private messages.
Note: this feature is part of my Pull Request, so if you do not see it, you may need to update your chess version or build it from the repository.
Final notes
My configuration:
(use-package chess
:ensure t
:config
(setq chess-images-separate-frame nil) ; Display the board in the same frame
(setq chess-images-default-size 100)) ; Piece size in pixels
One last piece of advice: play against humans. The AI is quite easy, and while winning is fun, it is not much of a challenge. You will also get to meet more people that way. Checkmate!
I hope you enjoy your chess games inside Emacs as much as I do.
This work is under a Attribution-NonCommercial-NoDerivatives 4.0 International license.
Support me on Ko-fi
Comments
There are no comments yet.