How Many Squares Are on a Chessboard? The Counting Trick

Last edited Oct 14, 2026 · 4 min read

Ask someone how many squares are on a chessboard and the quick answer is 64. That counts only the smallest squares. Wild Maths, a programme of the University of Cambridge's Millennium Mathematics Project alongside NRICH, poses the question as its Chessboard Challenge and nudges you with a hint: are all your squares the same size?

They are not. Once you count every size, the total is far bigger. The counting method below works for any grid, and it extends to rectangles and grids of dots. Four original puzzles follow. Every answer was checked by listing every possible square one at a time.

1. Count one size at a time

Wild Maths suggests asking how many different sizes of square there are, and how many squares of each size. On an 8 by 8 board the sizes run from 1 by 1 up to 8 by 8.

Now ask where the top-left corner of each size can go.

  • A 1 by 1 square can start in any of 8 columns and 8 rows: 8 times 8, or 64.
  • A 2 by 2 square needs one extra column and row of room, so it can start in only 7 columns and 7 rows: 49.
  • A 3 by 3 square can start in 6 by 6 places: 36.

The pattern continues all the way down to the single 8 by 8 square, which fits in exactly one place.

Square size How many fit
1 by 1 64
2 by 2 49
3 by 3 36
4 by 4 25
5 by 5 16
6 by 6 9
7 by 7 4
8 by 8 1
Total 204

So a chessboard holds 204 squares. For any square grid of side n, the total is the sum of the square numbers from 1 times 1 up to n times n.

2. The same trick on a rectangle

Wild Maths also asks: what about a rectangular board? The idea is unchanged, but the two directions give different counts. On a grid that is m squares tall and n squares wide, a square of side k fits in (m minus k plus 1) rows and (n minus k plus 1) columns. Multiply those, and add over every size that fits.

NRICH's Squares in Rectangles problem gives two worked totals you can test this on: a 2 by 3 rectangle contains 8 squares (6 small plus 2 of size 2), and a 3 by 4 rectangle contains 20 (12 plus 6 plus 2). NRICH then asks which rectangles contain exactly 100 squares. That one is left for you.

3. Squares that tilt

On a grid of dots, squares do not have to sit level. Four dots can form a square standing on its corner, as long as all four sides are equal and every corner is a right angle. These tilted squares are easy to miss, and they are the main trap in dot-grid counting puzzles.

A quick way to spot them: pick two dots and walk from one to the other, say 1 step right and 1 step up. Turn 90 degrees and repeat the same walk (1 step left and 1 step up). If you land on dots each time and close the shape, you have a square, tilted or not.

4. Puzzle 1

How many squares of all sizes are there in a 5 by 5 grid?

5. Puzzle 2

How many squares of all sizes are there in a grid 3 squares tall and 5 squares wide?

6. Puzzle 3

A strip of squares is 2 squares tall. How many squares long must it be to contain exactly 20 squares of all sizes?

7. Puzzle 4

A 4 by 4 grid of dots has 16 dots in total, evenly spaced. How many squares can you draw with all four corners on dots, counting tilted ones?

8. Answers

Puzzle 1: 55. Add 25 + 16 + 9 + 4 + 1.

Puzzle 2: 26. Size 1: 3 rows times 5 columns is 15. Size 2: 2 times 4 is 8. Size 3: 1 times 3 is 3. Squares of size 4 do not fit, so the total is 15 + 8 + 3 = 26.

Puzzle 3: 7 squares long. In a strip 2 tall and n long, there are 2n small squares and n minus 1 squares of size 2, for a total of 3n minus 1. Setting 3n minus 1 equal to 20 gives n = 7. No other length works, because each extra column adds exactly 3 squares.

Puzzle 4: 20. The dots outline a 3 by 3 grid of level squares, which gives 9 + 4 + 1 = 14. The other 6 are tilted. Four use a "1 across, 1 up" side: each fits inside a 3 by 3 block of dots, and the grid has four such blocks. Two more use a "1 across, 2 up" side (or "2 across, 1 up") and stretch across the whole grid. A full check of every set of four dots found exactly 20 squares.

9. Tips for counting puzzles

  • Count by size, not by eye. Scanning a picture for squares always misses some. A table of sizes never does.
  • Use corners. Asking where the top-left corner of each size can go turns counting into multiplication.
  • Start small. Wild Maths suggests counting a smaller board first. A 2 by 2 grid has 5 squares and a 3 by 3 grid has 14, and the pattern is easier to see from there.
  • Check for tilted shapes whenever the puzzle uses dots rather than drawn lines.

10. Key takeaways

  • A chessboard contains 204 squares: 64 small ones plus 140 larger ones.
  • A square of side k fits in (n minus k plus 1) positions along each side of the grid, so multiply the two directions and add over every size.
  • On a rectangle, the shorter side limits the largest square that fits.
  • A 2-tall strip of length n always holds 3n minus 1 squares.
  • Grids of dots allow tilted squares, so a 4 by 4 dot grid holds 20 squares, not 14.

Sources

  1. Wild Maths, University of Cambridge Millennium Mathematics Project, Chessboard Challenge
  2. NRICH, University of Cambridge Millennium Mathematics Project, Squares in Rectangles
CategoriesPuzzle Breakcounting puzzlesmath gamesbrain teasers