How would you find the number of squares on a chessboard?

Clearly there are 64 of the little squares on a chessboard (as you can see below), but this question is meant to ask you for more than just the number of the small squares since that would be too easy. There are other squares on the chessboard – note that if we combine 4 of the small squares on the board together then they form a 2×2 square, and we can even combine 16 of the small squares together to form a 4×4 square.


So, it should be clear that we need to count the other squares that are also on the chessboard. How can we approach this problem logically?

Think about positions of squares on the chessboard

Well, think about it – let’s take a 3×3 square as an example (that means a square that has 3 of the little squares on each side, which makes for a total of 9 little squares). If you look at the leftmost vertical edge of the chessboard, then you can see that there will be 6 different 3×3 squares that will have the leftmost column as the left outer edge. And if you look at the topmost horizontal edge of the entire chessboard, you’ll see that there will also be 6 different 3×3 squares. This means the 3×3 square can be in 6 positions horizontally and 6 positions vertically, giving a total of 6*6 = 36 3×3 squares on the chessboard.

Applying that same reasoning to the other possible squares on the chessboard, we can come up with the following table:

Square Size Total Appearances on Board
1×1 64
2×2 49
3×3 36
4×4 25
5×5 16
6×6 9
7×7 4
8×8 1

Number of squares for an NxN chessboard?

What if we want to find the number of squares for a chessboard of size NxN, where N is any number. Do you notice a pattern in the results in the table above? Well, if you take a look at the results that we showed above for the normal-sized 8×8 chessboard, you can see that the number of squares is equal to the sum of squares from 12 to 82, where 8 is equal to N. So, we can say in more general terms that the sum of squares for a chessboard of size NxN is equal to n2 + (n-1)2 + (n-2)2 + …. (1)2.

Formula for number of squares on NxN chessboard

This is a common summation in math, and is actually equal to n(n + 1)(2n + 1)/6 – so for a chessboard of size nxn, this formula will give you the count of all of the squares on the board.

Hiring? Job Hunting? Post a JOB or your RESUME on our JOB BOARD >>

Subscribe to our newsletter for more free interview questions.

2 thoughts on “Find number of squares chessboard”