Adële's blog

fen2board for chess players

2026-01-26 07:40

A Python script to convert chess positions (FEN notation) and games (PGN format) into beautiful chessboard diagrams.

Available on codeberg

Supports multiple output formats:

Perfect for creating printable chess study materials, generating game annotations, or displaying positions in the terminal.

Features

Requirements

Installation

# Clone or download the script
git clone https://codeberg.org/adele/fen2board.git
cd fen2board

# Make it executable (optional)
chmod +x fen2board.py

Usage

Display a position in the terminal

Unicode display (default)

python fen2board.py "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"

Terminal Unicode display

ASCII monochrome

python fen2board.py "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1" -am
  +----------------+
8 |r n b q k b n r |
7 |p p p p p p p p |
6 |  =   =   =   = |
5 |=   =   =   =   |
4 |  =   =   =   = |
3 |=   =   =   =   |
2 |P P P P P P P P |
1 |R N B Q K B N R |
  +----------------+
   a b c d e f g h

ASCII with colors

python fen2board.py "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1" -ac

ASCII color

View from Black's perspective

python fen2board.py "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1" --black

Process a PGN game

# Display all moves in terminal
python fen2board.py --pgn "1. e4 e5 2. Nf3 Nc6 3. Bb5 a6"

# Display moves 5-10 only
python fen2board.py --pgn "..." --start 5 --end 10

# Read PGN from stdin
cat mygame.pgn | python fen2board.py --pgn

Generate RTF documents

Chess Cases font font (default)

python fen2board.py "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1" -r output.rtf

RTF with Chess Cases font

ASCII monochrome RTF

python fen2board.py "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1" -am -r output.rtf

RTF ASCII Mono

ASCII color RTF

python fen2board.py "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1" -ac -r output.rtf

RTF ASCII Color

PGN game to RTF with Chess Cases font

python fen2board.py --pgn mygame.pgn -r analysis.rtf

PGN game to ASCII color RTF

cat mygame.pgn | python fen2board.py --pgn -ac -r analysis.rtf

Command-line Options

Option Short Description
--black -b Display board from Black's perspective
--pgn [FILE] -p [FILE] Process PGN game (use - or omit for stdin)
--start N -s N Starting move number (PGN only)
--end N -e N Ending move number (PGN only)
--format-rtf FILE -r FILE Generate RTF file
--ascii-monochrome -am Use ASCII characters (monochrome)
--ascii-color -ac Use ASCII characters with ANSI colors

Display Modes

Unicode Mode (Default)

Uses Unicode chess pieces (♔♕♖♗♘♙) with ANSI colors for terminal display. Best for modern terminals with Unicode support.

ASCII Monochrome (-am)

Uses standard ASCII characters:

ASCII Color (-ac)

Uses ASCII characters with ANSI color codes:

Chess Cases Font (RTF)

Optimal output using the Chess Cases font. Requires the font to be installed. Generates publication-quality diagrams.

RTF Output Details

Examples

Tactic puzzle in terminal

python fen2board.py "r3r1k1/ppp2ppp/2n5/3p2N1/N2P2n1/2P4P/PP1Bb1Pq/R3Q1K1 w - - 1 22"

Game analysis to RTF

# Create a professional game booklet
python fen2board.py --pgn mygame.pgn -r analysis.rtf

Study material in ASCII

# Generate printable ASCII diagrams (compact, good for emails)
python fen2board.py --pgn study.pgn -am -r study.rtf

Color diagrams for presentation

# Beautiful colored ASCII diagrams
python fen2board.py --pgn game.pgn -ac -r presentation.rtf

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.

By Adële - adele.pages.casa

Credits

Acknowledgments

Special thanks to the chess community for the PGN and FEN standards that make chess software interoperable.