Sum of Squares Calculator
Find Σx² and the sum of squared deviations Σ(x − x̄)² for any list of numbers, with the count, the mean and the working shown.
Calculate the sum of squares (Σx²) and the sum of squared deviations from the mean (Σ(x − x̄)²) of a list of numbers. Supports CSV/Excel format for easy data import.
Commas separate values unless you tick the box below. Currency symbols ($ € £ ¥) are ignored; decimals, negative numbers and scientific notation are supported. Fix invalid entries before calculating. Press Ctrl+Enter to calculate.
Tip: commas are read as separators, so 1,000 counts as two numbers (1 and 000). If your list uses commas for thousands, tick the box above.
Each value squared, then all the squares added together.
Each value minus the mean, squared, then added; statistics calls this SS.
How many numbers were read from your list.
The sum of the values divided by n.
- Enter numbers separated by commas (,,), spaces, or new lines
- Copy and paste data directly from Excel or CSV files
- Use Ctrl+Enter for quick calculation
- Click copy buttons to copy individual results
- Download results as CSV or JSON files
Σx² squares each number and adds the squares. Σ(x − x̄)² first subtracts the mean from each number, then squares and adds; it equals Σx² − (Σx)² ÷ n. For the whole numbers 1 to n, 1² + 2² + … + n² = n(n + 1)(2n + 1) ÷ 6.
What is the sum of squares?
"Sum of squares" is used for two different quantities, and calculators and textbooks do not all mean the same one. That is why this calculator shows both results side by side.
Sum of the squares of the values, Σx²
Square each number in the list, then add the squares. For 3, 5 and 8 this is 3² + 5² + 8² = 9 + 25 + 64 = 98. This is the meaning used in arithmetic and number theory, and it is what the SUMSQ function returns in Excel and Google Sheets.
Sum of squared deviations from the mean, Σ(x − x̄)²
First find the mean x̄. Subtract it from each number, square each difference, then add them. In statistics this total is usually written SS and is often just called "the sum of squares". It measures how far the values spread around their mean, so it does not change if you add the same constant to every value. Excel and Google Sheets return it with the DEVSQ function.
What is the sum of squares formula?
For a list of n values x₁, x₂, …, xₙ with mean x̄ = Σx ÷ n:
Σx² = x₁² + x₂² + … + xₙ²
SS = Σ(x − x̄)² = (x₁ − x̄)² + (x₂ − x̄)² + … + (xₙ − x̄)²
Expanding the squares gives a shortcut that links the two definitions:
Σ(x − x̄)² = Σx² − (Σx)² ÷ n
The shortcut needs only the sum and the sum of squares, so you never have to work out each deviation. It also shows that the two results are equal only when the mean is 0; otherwise Σx² is larger by (Σx)² ÷ n. The calculator uses this identity with exact decimal arithmetic, and its working line shows the substitution.
How do you calculate the sum of squares step by step?
Take the five values 4, 7, 9, 10 and 15.
- Add the values: 4 + 7 + 9 + 10 + 15 = 45. There are n = 5 values, so the mean is 45 ÷ 5 = 9.
- Square each value: 16, 49, 81, 100 and 225. Their total is Σx² = 471.
- Subtract the mean from each value: −5, −2, 0, 1 and 6. These deviations always add up to 0.
- Square each deviation: 25, 4, 0, 1 and 36. Their total is Σ(x − x̄)² = 66.
| x | x² | x − x̄ | (x − x̄)² |
|---|---|---|---|
| 4 | 16 | −5 | 25 |
| 7 | 49 | −2 | 4 |
| 9 | 81 | 0 | 0 |
| 10 | 100 | 1 | 1 |
| 15 | 225 | 6 | 36 |
| Total | 471 | 0 | 66 |
Check the result with the shortcut: 471 − 45² ÷ 5 = 471 − 2025 ÷ 5 = 471 − 405 = 66. Paste the same five numbers into the calculator above and it returns Σx² = 471, Σ(x − x̄)² = 66, n = 5 and a mean of 9.
How is the sum of squares related to variance?
Variance is the sum of squared deviations divided by a count. Population variance divides SS by n, and sample variance divides it by n − 1. In the example, the population variance is 66 ÷ 5 = 13.2 and the sample variance is 66 ÷ 4 = 16.5. The standard deviation is the square root of the variance: about 3.633 for the population and about 4.062 for the sample.
If you need those figures directly, the variance calculator computes population and sample variance and standard deviation from the same kind of list. The same idea appears in regression, where the residual sum of squares adds up the squared differences between observed and predicted values; the guide to the sum of squared residuals walks through it.
What is the sum of the first n squares?
For the whole numbers 1, 2, 3, …, n there is a closed formula, so you do not need to add the squares one by one:
1² + 2² + 3² + … + n² = n(n + 1)(2n + 1) ÷ 6
For n = 5: 5 × 6 × 11 ÷ 6 = 55, which matches 1 + 4 + 9 + 16 + 25. For n = 10: 10 × 11 × 21 ÷ 6 = 385. For n = 100 the formula gives 338,350. When the list you enter is exactly the numbers 1 to n, in any order, the calculator adds this formula to its working as a check.
Which sum of squares should you use?
Use Σx² when a problem asks for the squares of the numbers themselves, such as the sum of the squares of the first ten integers or the squared length of a vector. Use Σ(x − x̄)² when the question is about spread, variance, standard deviation, ANOVA or regression, which is what most statistics courses mean by "sum of squares". If the source does not say, check whether the mean is subtracted in its formula.
How does the calculator read your numbers?
Separate values with commas, spaces, semicolons or new lines, or paste a column straight from Excel or Google Sheets. Currency symbols ($, €, £, ¥, ₹) are ignored, and a value in brackets such as (12.50) is read as −12.50. If your numbers use commas as thousands separators, such as 1,234.56, tick the thousands option so each one is read as a single number. Decimals, negative numbers and scientific notation such as 2.5e3 are accepted. For values with up to 22 digits before the decimal point and 20 after it, Σx² is computed exactly in decimal, with no rounding to a fixed number of places. The mean is shown to 12 significant digits, and so is Σ(x − x̄)² when dividing by n does not give a terminating decimal. The calculation runs in your browser and your list is not uploaded; the last list you calculate is kept in this browser so it is still there when you come back.
Frequently Asked Questions
Is the sum of squares the same as the square of the sum?
No. The sum of squares squares each number first and then adds: 3² + 5² + 8² = 98. The square of the sum adds first and then squares: (3 + 5 + 8)² = 16² = 256.
Can the sum of squares be negative?
No. Every square is zero or positive, so both Σx² and Σ(x − x̄)² are zero or positive. Σ(x − x̄)² is zero only when all the values are equal, and Σx² is zero only when every value is zero.
Why are Σx² and Σ(x − x̄)² different?
Σ(x − x̄)² measures spread around the mean, while Σx² measures size around zero. They differ by (Σx)² ÷ n, so they are equal only when the mean is 0. For 3, 5 and 8 the difference is 98 − 12.666… = 85.333…, which is 16² ÷ 3.
How do I calculate the sum of squares in Excel or Google Sheets?
Use =SUMSQ(A1:A10) for the sum of the squares of the values, Σx². Use =DEVSQ(A1:A10) for the sum of squared deviations from the mean, Σ(x − x̄)². Both functions work the same way in Excel and Google Sheets.
How does this relate to the total and residual sums of squares in regression?
The total sum of squares (SST) is Σ(y − ȳ)² of the observed y values, so enter those values and read the Σ(x − x̄)² result. The residual sum of squares adds the squared residuals, which are observed minus predicted values; if you paste the residuals, the Σx² result is the residual sum of squares. Textbooks differ on whether SSR means the residual or the regression sum of squares, so check the definition your course uses.
All Calculator Tools
Explore our complete collection of mathematical calculators. Each tool is designed for accuracy, speed, and ease of use.
Target Sum Finder
Find which of up to 20 amounts add up to a target. Each line is used once, with exact decimal matching.
Use CalculatorAverage Calculator
Calculate the mean (average) of multiple numbers with detailed steps.
Use CalculatorAverage of 2 Numbers
Quick and simple calculator for finding the average of two numbers.
Use CalculatorCount Calculator
Count how many numbers are in a list, with positive, negative, even, odd, and duplicate breakdowns.
Use CalculatorVariance Calculator
Calculate variance, standard deviation, and statistical measures.
Use CalculatorSummation Calculator
Calculate series using sigma notation with step-by-step solutions.
Use CalculatorInfinite Sum Calculator
Evaluate convergent infinite series including geometric and p-series.
Use CalculatorRiemann Sum Calculator
Approximate definite integrals using various Riemann sum methods.
Use CalculatorSum of Series Calculator
Calculate arithmetic, geometric, harmonic and custom mathematical series.
Use CalculatorWhy Choose Our Calculators?
Get instant results with mathematical precision you can trust.
All calculations happen locally in your browser. No data stored or shared.
Works perfectly on all devices - desktop, tablet, and mobile.