Note: This problem is the reverse, or complement, of Problem 61144 - FEN Chess Notation.
Given a FEN (Forsyth-Edwards Notation) string representing a chess board position, convert it to an 8-by-8 character matrix.
FEN notation encodes each rank (row) from top to bottom, separated by slashes (`/`). Numbers 1-8 represent consecutive empty squares.
The output matrix uses:
  • Dots (`.`) for empty squares
  • Letters for pieces: `rnbqkp` (black pieces) and `RNBQKP` (white pieces)
If the FEN string contains additional fields (castling rights, en passant, etc.), ignore everything after the first space and only parse the board position.
Example 1
Starting position.
Input: 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR'
Output:
['rnbqkbnr';
'pppppppp';
'........';
'........';
'........';
'........';
'PPPPPPPP';
'RNBQKBNR']
Example 2
After white plays e4:
Input: 'rnbqkbnr/pppppppp/8/8/4P3/8/PPPP1PPP/RNBQKBNR'
Output:
['rnbqkbnr';
'pppppppp';
'........';
'........';
'....P...';
'........';
'PPPP.PPP';
'RNBQKBNR']
Note: The `4P3` means 4 empty squares, then P, then 3 empty squares.

Solution Stats

9 Solutions

5 Solvers

Last Solution submitted on Jan 11, 2026

Last 200 Solutions

Solution Comments

Show comments
Loading...

Problem Recent Solvers5

Suggested Problems

More from this Author54

Problem Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!