Maths & numbers

Sum of the first n squares calculator

Add the squares from 1² through n² without listing each term.

Your numbers

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

The difference between the sums at n and n−1 is exactly n². This gives a direct check on the formula.

THE FORMULAn(n+1)(2n+1)/6

A worked example

1² + 2² + … + 10² = 385.

Good to know

An empty sum is zero.

Evaluate the square-sum formula

For ten terms, substitute n = 10 into n(n + 1)(2n + 1)/6. This gives 10 × 11 × 21/6 = 385. The summed terms are 1² through 10², with no missing integer bases. The result is the total of their squared values.

For a smaller check, n = 3 gives 3 × 4 × 7/6 = 14, matching 1 + 4 + 9. The diagram displays these three square areas. It illustrates why summing squares grows faster than simply adding the bases 1 + 2 + 3.

Squares with sides one, two and three contain one, four and nine unit squares1² = 12² = 43² = 9
The three grids together contain 14 unit squares. They illustrate the first three squared terms.

Keep the square outside the correct operation

Adding the first three integers and then squaring gives (1 + 2 + 3)² = 36, which differs from the square sum 14. Expanding a square of a sum introduces cross terms such as 2 × 1 × 2. Those terms are absent when the individual squares are added.

The Sum of the first n cubes calculator uses the square of a triangular number, an identity specific to that different sum. Here the leading cubic term is about n³/3 for large n. If you need the square sum from base a through b, subtract the sum through a − 1 from the sum through b. For 4² + 5², the difference is 55 − 14 = 41.

A few questions, answered

Does n mean the final square or its base?

It is the final base and also the number of terms. Entering 10 sums through 10², or 100.

What does zero return?

The empty sum is zero, and the formula agrees when n = 0.

Find your calculator

Start typing to explore the library.