All Chess Positions
EN
Open the map

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.

a8b7c6d5e4f3g2h1

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:

  1. a1 b5 c8 d6 e3 f7 g2 h4
  2. a1 b6 c8 d3 e7 f4 g2 h5
  3. a2 b4 c6 d8 e3 f1 g7 h5
  4. a2 b5 c7 d1 e3 f8 g6 h4
  5. a2 b5 c7 d4 e1 f8 g6 h3
  6. a2 b6 c1 d7 e4 f8 g3 h5
  7. a2 b6 c8 d3 e1 f4 g7 h5
  8. a2 b7 c3 d6 e8 f5 g1 h4
  9. a2 b7 c5 d8 e1 f4 g6 h3
  10. a3 b5 c2 d8 e1 f7 g4 h6 — symmetric: 4 versions
  11. a3 b5 c8 d4 e1 f7 g2 h6
  12. a3 b6 c2 d5 e8 f1 g7 h4
a8b7c6d5e4f3g2h1

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:

BoardSolutionsDistinct
1 × 111
2 × 200
3 × 300
4 × 421
5 × 5102
6 × 641
7 × 7406
8 × 89212
9 × 935246
10 × 1072492
11 × 112,680341
12 × 1214,2001,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.

Sources