Chess by the numbers
The eight queens puzzle: how many solutions are there?
There are 92 ways to place eight queens on a chessboard so that no queen attacks another. Counting solutions that differ only by turning or mirroring the board as one, there are 12.
One solution: queens on a1 b5 c8 d6 e3 f7 g2 h4. No two share a row, a column or a diagonal.
Every number on this page was computed by this site, by trying every placement column by column and backing up whenever a new queen would be attacked; the totals match the published ones.
The 12 distinct solutions
A board can be turned four ways and mirrored, which makes eight versions of most solutions. Eleven of the twelve distinct solutions have eight versions each and one has only four, because it looks the same after half a turn: 11 × 8 + 4 = 92. Each solution is written with the queen’s square on files a to h:
- a1 b5 c8 d6 e3 f7 g2 h4
- a1 b6 c8 d3 e7 f4 g2 h5
- a2 b4 c6 d8 e3 f1 g7 h5
- a2 b5 c7 d1 e3 f8 g6 h4
- a2 b5 c7 d4 e1 f8 g6 h3
- a2 b6 c1 d7 e4 f8 g3 h5
- a2 b6 c8 d3 e1 f4 g7 h5
- a2 b7 c3 d6 e8 f5 g1 h4
- a2 b7 c5 d8 e1 f4 g6 h3
- a3 b5 c2 d8 e1 f7 g4 h6 — symmetric: 4 versions
- a3 b5 c8 d4 e1 f7 g2 h6
- a3 b6 c2 d5 e8 f1 g7 h4
The symmetric solution, a3 b5 c2 d8 e1 f7 g4 h6: turn the board half a turn and the queens land on the same squares.
Other board sizes
The same puzzle works with n queens on an n × n board. It has no solution on boards of 2 × 2 and 3 × 3, and the count grows fast after that:
| Board | Solutions | Distinct |
|---|---|---|
| 1 × 1 | 1 | 1 |
| 2 × 2 | 0 | 0 |
| 3 × 3 | 0 | 0 |
| 4 × 4 | 2 | 1 |
| 5 × 5 | 10 | 2 |
| 6 × 6 | 4 | 1 |
| 7 × 7 | 40 | 6 |
| 8 × 8 | 92 | 12 |
| 9 × 9 | 352 | 46 |
| 10 × 10 | 724 | 92 |
| 11 × 11 | 2,680 | 341 |
| 12 × 12 | 14,200 | 1,787 |
Where the puzzle comes from
The chess composer Max Bezzel published the eight queens puzzle in 1848, and Franz Nauck published the first solutions in 1850. Many mathematicians have worked on it since, Carl Friedrich Gauss among them.
Questions people ask
Can nine queens fit on a chessboard without attacking each other?
No. Each queen needs a column of its own, and there are only eight columns.
How many solutions have a queen in a corner?
16 of the 92, such as a1 b5 c8 d6 e3 f7 g2 h4, with a queen on a1.
What about other chess puzzles of this kind?
The best known is the knight’s tour: a knight visiting every square once. And the board itself holds more squares than it seems; see how many squares are on a chessboard.