Deviation Calculator: Mean, Variance & SD
The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.
A deviation calculator works out how spread out a set of numbers is by returning the mean, variance, and standard deviation. You enter a list of values, and the calculator gives you the average (mean), the average squared distance from that mean (variance), and the square root of the variance (standard deviation). The standard deviation is the headline result because it is in the same units as your original data, making it the most intuitive measure of spread.
Formula
The standard deviation formula depends on whether your data is a sample or the entire population. For a sample (most common in statistics), the formula is:
s = sqrt( Σ(xáµ¢ – xÌ„)² / (n – 1) )
For a population, the formula is:
σ = sqrt( Σ(xáµ¢ – μ)² / n )
Where:
- xᵢ – each individual value in the dataset
- x̄ (sample mean) or μ (population mean) – the average of all values
- n – the number of values
- Σ – the sum of the squared differences
- s – sample standard deviation
- σ – population standard deviation
The variance is simply the square of the standard deviation (s² or σ²). The mean is calculated as the sum of all values divided by the count.
Worked Example
Using the default values from the calculator above: 4, 8, 15, 16, 23, 42.
- Calculate the mean: (4 + 8 + 15 + 16 + 23 + 42) / 6 = 108 / 6 = 18
- Find each deviation from the mean: 4-18 = -14, 8-18 = -10, 15-18 = -3, 16-18 = -2, 23-18 = 5, 42-18 = 24
- Square each deviation: 196, 100, 9, 4, 25, 576
- Sum the squared deviations: 196 + 100 + 9 + 4 + 25 + 576 = 910
- Divide by n-1 for sample variance: 910 / 5 = 182
- Take the square root for sample standard deviation: sqrt(182) ≈ 13.49
The calculator shows a sample standard deviation of 13.49 and a population standard deviation of 12.32 (910/6 ≈ 151.67, sqrt ≈ 12.32). The sample version is slightly larger because dividing by n-1 corrects for the fact that a sample tends to underestimate the true spread.
Sample vs. Population: Which One Do You Need?
The single most common mistake is using the wrong formula. The sample standard deviation (n-1) is used when your data is a subset of a larger group – for example, measuring the heights of 30 students to estimate the variation among all students in a school. The population standard deviation (n) is used when you have every possible value – for example, the test scores of all 30 students in one class. If you are unsure, choose the sample version; most real-world data is a sample.
In the calculator above, both are provided so you can compare. The difference shrinks as n grows; for n=100, the two results are nearly identical.
How to Read the Result
The standard deviation tells you the typical distance of a data point from the mean. A small value (relative to the mean) means the numbers cluster tightly; a large value means they are spread out. For example, if the mean test score is 75 with a standard deviation of 5, most scores are between 70 and 80. If the standard deviation is 20, scores range widely from about 35 to 115.
For roughly bell-shaped (normal) distributions, about 68% of values fall within one standard deviation of the mean, 95% within two, and 99.7% within three. This is known as the empirical rule, but it only applies to symmetric, unimodal data – not to skewed distributions.
Common Mistakes and Pitfalls
- Using n instead of n-1 for sample data – this makes the standard deviation slightly too small, which can understate variability.
- Mixing units – if your data is in meters, the standard deviation is in meters, but the variance is in square meters. Don’t compare variance to the mean directly.
- Ignoring outliers – a single extreme value inflates the standard deviation. Always plot your data or check for outliers before trusting the result.
- Rounding too early – keep full precision during intermediate steps; round only the final answer. Rounding the mean to 2 decimals before computing deviations can change the result noticeably.
- Assuming normality – standard deviation is still a valid measure of spread for non-normal data, but the 68-95-99.7 rule does not apply.
Why Standard Deviation Matters More Than Variance
Variance is mathematically convenient (it adds up nicely when combining independent sources of variation), but it is hard to interpret because the units are squared. Standard deviation brings the measure back to the original units, so it is the number you report in papers, dashboards, and everyday comparisons. For example, if you are comparing the consistency of two machines filling bottles, the one with the smaller standard deviation in fill volume is more precise. The variance would tell you the same thing, but the standard deviation is directly comparable to the bottle volume itself.
Alternatives and Related Measures
Standard deviation is not always the best measure of spread. Consider these alternatives:
- Range – the difference between the maximum and minimum. Simple but highly sensitive to outliers.
- Interquartile range (IQR) – the range of the middle 50% of data (Q3 – Q1). Robust to outliers, good for skewed distributions.
- Mean absolute deviation – the average absolute distance from the mean. Easier to explain but less mathematically useful than variance.
- Coefficient of variation – standard deviation divided by the mean. Useful for comparing spread across datasets with different means.
If your data is heavily skewed (e.g., incomes, house prices), report the median and IQR instead of the mean and standard deviation. The median is the middle value, and the IQR describes the middle half of the data, both of which are unaffected by extreme values.
Frequently Asked Questions
What is the difference between standard deviation and variance?
Variance is the average of the squared differences from the mean. Standard deviation is the square root of that number. Variance is in squared units (e.g., dollars²), while standard deviation is in the original units (e.g., dollars), making it easier to interpret.
Why do we use n-1 in the sample standard deviation?
Because a sample tends to be less spread out than the full population – the sample mean is always closer to the sample values than the true population mean would be. Dividing by n-1 (called Bessel’s correction) compensates for this bias, giving an unbiased estimate of the population variance.
Can standard deviation be negative?
No. Standard deviation is the square root of a sum of squared numbers, which is always non-negative. A standard deviation of zero means all values are identical. Negative values are impossible.
How do I calculate standard deviation in Excel?
Use STDEV.S for a sample and STDEV.P for a population. For example, =STDEV.S(A1:A10) calculates the sample standard deviation of the numbers in cells A1 through A10. The same logic applies to Google Sheets.
What does a standard deviation of 1 mean?
It means the typical distance of a data point from the mean is 1 unit. Whether that is large or small depends on the context. If the mean is 100, a standard deviation of 1 indicates very tight clustering; if the mean is 0, it indicates moderate spread.
Is standard deviation affected by outliers?
Yes, strongly. Because the formula squares each deviation, an outlier far from the mean gets squared, disproportionately increasing the standard deviation. For example, in the dataset 1, 2, 3, 4, 100, the standard deviation is about 43.7, but without the 100 it is about 1.29. For outlier-prone data, use the median and IQR instead.
Related
Formula used
in list | Data values (comma separated) | 4, 8, 15, 16, 23, 42 | 0 out mean | Mean | - | mean(list) | 2 out sd | Standard deviation (sample) | - | sd(list) | 2 out var | Variance (sample) | - | var(list) | 2 out psd | Standard deviation (population) | - | psd(list) | 2 out pvar | Variance (population) | - | pvar(list) | 2
Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.