For r rows and c columns, choose two of the r + 1 horizontal lines and two of the c + 1 vertical lines. The total is r(r + 1)c(c + 1) ÷ 4, including squares.
Decide which shapes count
This guide uses a complete rectangular grid with sides on its horizontal and vertical grid lines. Squares count as rectangles. Tilted shapes and diagonals do not count, and there are no missing cells or broken lines.
Rows and columns describe the cells, not the boundary lines. Two rows have three horizontal lines; three columns have four vertical lines. The outer border counts too.
Choose boundaries to get 18 rectangles in a 2-by-3 grid
Each rectangle needs a top and bottom boundary. From three horizontal lines, the possible pairs are first–second, first–third and second–third: 3 choices. From four vertical lines, there are 6 choices for the left and right boundaries.
Every horizontal pair works with every vertical pair, so the total is 3 × 6 = 18. Each selection identifies exactly one rectangle. You are choosing unordered pairs of distinct lines: swapping “top” and “bottom” does not create another shape.

Check the answer by counting every size
| Height × width in cells | Number of positions |
|---|---|
| 1 × 1 | 6 |
| 1 × 2 | 4 |
| 1 × 3 | 2 |
| 2 × 1 | 3 |
| 2 × 2 | 2 |
| 2 × 3 | 1 |
| Total | 18 |
A rectangle h cells high and w cells wide has (r − h + 1)(c − w + 1) possible positions. For example, a 1-by-2 rectangle fits in two horizontal positions in each of two rows: 2 × 2 = 4. Add all six size counts to confirm 18.
Apply the same formula to a larger complete grid
A grid with r rows has r + 1 horizontal boundaries. The number of pairs is r(r + 1) ÷ 2. Similarly, c columns provide c(c + 1) ÷ 2 vertical pairs. Multiplying gives r(r + 1)c(c + 1) ÷ 4.
For a 3-by-4 grid, the horizontal count is 3 × 4 ÷ 2 = 6 and the vertical count is 4 × 5 ÷ 2 = 10. Therefore it contains 60 rectangles. Use the pair counts before multiplying if the combined formula looks crowded.
Try six rectangle-counting questions
Count rectangles of every size, including squares, with sides on the grid lines. Each question uses a complete grid of square cells.
1. How many rectangles are in a 1-row, 1-column grid?
1. Two horizontal and two vertical lines each provide one pair. The single square is also a rectangle.
2. How many rectangles are in a 1-row, 4-column grid?
10. There is one horizontal pair and 5 × 4 ÷ 2 = 10 vertical pairs. Counting widths gives 4 + 3 + 2 + 1 = 10.
3. How many rectangles are in a 2-row, 2-column grid?
9. Three horizontal lines give three pairs, as do three vertical lines. The total is 3 × 3 = 9.
4. How many rectangles are in a 2-row, 3-column grid?
18. Multiply three horizontal pairs by six vertical pairs. The six small cells are only one size within the total.
5. How many rectangles are in a 3-row, 4-column grid?
60. Four horizontal lines give six pairs; five vertical lines give ten. Thus 6 × 10 = 60.
6. How many rectangles are in a 4-row, 5-column grid?
150. Five horizontal lines give ten pairs; six vertical lines give fifteen. Multiply 10 × 15 = 150.
How many rectangles and squares are on a chessboard?
A chessboard is an 8 × 8 grid, so it has 9 lines in each direction. There are 9 × 8 ÷ 2 = 36 ways to choose two horizontal lines and 36 ways to choose two vertical lines, giving 36 × 36 = 1,296 rectangles.
For squares, count each size separately. A k × k square fits in (9 − k) positions across and (9 − k) down:
| Square size | Positions |
|---|---|
| 1 × 1 | 64 |
| 2 × 2 | 49 |
| 3 × 3 | 36 |
| 4 × 4 | 25 |
| 5 × 5 | 16 |
| 6 × 6 | 9 |
| 7 × 7 | 4 |
| 8 × 8 | 1 |
| All squares | 204 |
So a chessboard has 204 squares and 1,092 rectangles that are not squares. Enter 8 rows and 8 columns in the counter above to check the same totals.
Use the free challenge to check your method
The free Math Puzzle Challenge includes the 2-by-3 grid and an answer check. Solve it before opening the hint, then compare the explanation with your boundary pairs. These original website exercises are separate from Math Riddles app levels.
If you missed a constraint, use the puzzle strategy checklist. For another grid task, try missing-number puzzles; for the products, review mental multiplication shortcuts.
Common questions
How many rectangles are on a chessboard?
1,296, including 204 squares. An 8 × 8 board has 9 lines in each direction, so there are 36 × 36 = 1,296 ways to pick two horizontal and two vertical lines.
How many squares are on a chessboard?
204: 64 one-by-one squares, 49 two-by-two, 36, 25, 16, 9, 4 and finally the single 8 × 8 board.
Do squares count when counting rectangles?
Yes, under the rule used here. A square is a rectangle with equal side lengths. Read the question carefully if it excludes squares.
Does turning the grid sideways change the total?
No. Swapping rows and columns swaps the two pair counts without changing their product.
Can I use the formula on a grid with missing lines?
Not directly. The formula assumes every chosen pair of horizontal and vertical lines forms a complete rectangle.
Published by Moocsoft, the studio behind Math Riddles. This guide uses AI assistance. How we prepare guides, label examples and handle corrections.