Sum of the First n Squares Calculator
Sum the squares up to n².
Result
How it is calculated
The tool adds 1² + 2² + … + n² with the closed form S = n × (n + 1) × (2n + 1) / 6, so no term-by-term addition is needed. n is how many squares you add, counting from 1: the last term is n² itself. It must be a whole number of at least 1; zero, negatives and decimals give no result. The answer is an exact integer shown with thousands separators. The arithmetic is done in whole numbers, dividing by 6 before the final multiplication, so every digit is exact. The largest n accepted is 3,000,000, whose sum is 9,000,004,500,000,500,000; anything larger would pass the 64-bit integer limit and shows no result rather than a rounded guess.
Worked example
Add the squares from 1² to 10². Here n = 10, n + 1 = 11 and 2n + 1 = 21. Multiply the three numbers: 10 × 11 × 21 = 2,310. Divide by 6: 2,310 / 6 = 385. The calculator shows 385. Adding by hand (1 + 4 + 9 + 16 + 25 + 36 + 49 + 64 + 81 + 100) gives the same total.
Common mistakes
- Squaring the plain sum instead. (1 + 2 + … + n)² is the sum of cubes, not the sum of squares.
- Reading the answer as the sum of cubes. The cube sum is n² × (n + 1)² / 4, which is much larger.
- Forgetting the 2n + 1 factor, or using 2n − 1, which gives a different series.
- Expecting the series to start somewhere other than 1². To sum squares from 5² to 10², subtract the sum to 4 from the sum to 10.
- Entering a decimal such as 10.5 or a value above 3,000,000. Only whole n up to that limit gives a result.
About this calculator
The sum of the first n perfect squares, 1² + 2² + 3² + … + n², has a closed-form shortcut known since antiquity: n(n+1)(2n+1) ÷ 6, which gives the exact total without adding every term one by one. It is one of the classic results proved by mathematical induction in introductory algebra and number theory courses, alongside the simpler sum-of-first-n-integers formula.
Beyond being a standard proof exercise, this closed form appears in statistics as part of deriving variance and sum-of-squared-deviations formulas, in physics when summing discrete quantized energy levels, and in computer science as a textbook example for analyzing algorithm time complexity, since a nested loop that runs n² operations per outer iteration accumulates a total step count following exactly this formula.
Was this helpful?
You can pick up to 3 reactions.
Popular calculators
Loan Calculator
Monthly payment, total interest and full amortization schedule.
Percentage Calculator
Percent change, percent of, and ratio calculations.
Discount Calculator
Calculate final price, savings, and discount amount.
BMI Calculator
Body mass index from height and weight (metric or imperial).
Age Calculator
Compute your exact age in years, months and days from a birth date.
Compound Interest Calculator
Calculate the final amount and interest earned with compounding.
All Calculators
- Loan Calculator
- Profit Calculator
- Discount Calculator
- BMI Calculator
- Percentage Calculator
- Ideal Weight Calculator
- Age Calculator
- Pregnancy Due Date Calculator
- Compound Interest Calculator
- BMR Calculator (Basal Metabolic Rate)
- Tip Calculator
- Fuel Cost Calculator
- Date Difference Calculator
- Sleep Cycle Calculator
- Daily Water Intake Calculator
- Simple Interest Calculator
- Heart Rate Zones Calculator
- Running Pace Calculator
- Pet Age Calculator
- Calories Burned Calculator
- Macro Calculator
- TDEE Calculator (Total Daily Energy Expenditure)
- Waist-to-Hip Ratio Calculator
- Honor Roll Calculator
- One Rep Max (1RM) Calculator
- Ovulation Calculator
- Electricity Cost Calculator
- Unit Price Calculator
- Savings Goal Calculator
- Break-Even Point Calculator
- Paint Calculator
- Course Grade Average Calculator
- Business Days Calculator
- Time Duration Calculator
- Fuel Economy Calculator
- Temperature Converter
- Tile Calculator
- Aspect Ratio Calculator
- Roman Numeral Converter
- Goal Weight Timeline Calculator
- Salary Converter (Hourly to Annual)
- Credit Card Validator (Luhn)
- Body Surface Area (BSA) Calculator
- Feels-Like Temperature Calculator
- Ohm’s Law Calculator
- PPI (Pixel Density) Calculator
- Molar Mass Calculator
- Zodiac Sign Calculator (Western + Chinese)
- IBAN Validator
- Shoe Size Converter
- Country Info & Dialing Code Lookup
- Time Zone Difference (World Clock)
- CAGR (Compound Annual Growth Rate) Calculator
- Rule of 72 Calculator
- Blood Alcohol Content (BAC) Calculator
- Lean Body Mass (LBM) Calculator
- Pythagorean Theorem Calculator
- Speed Converter
- Download Time Calculator
- Date Calculator (Add/Subtract)
No calculators found
Comments