Sample Variance and Standard Deviation Calculator
Written by Thierno Sadou Diallo, formula verified per our methodology • Last checked on 9/6/2026
The sample standard deviation is calculated by summing the squared deviations from the mean, dividing by (n−1), then taking the square root. For the values 2, 4, 4, 4, 5, the mean is 3.8 and the sample standard deviation is about 1.10.
Explanation
Variance and standard deviation measure how spread out a data set is around its mean: the more individual values deviate from the mean, the higher these two indicators. This calculator uses the sample variance, with a denominator of (n−1) rather than n (an adjustment called Bessel's correction): this correction compensates for the fact that a sample tends to slightly underestimate the true variance of the population it is drawn from, since the sample's own mean is itself calculated from the same data. This is the appropriate convention whenever the data represents a sample rather than the entire population — the most common situation in practice, where the complete data for a population is rarely available. This calculator is distinct from our coefficient of variation calculator, which takes the mean and standard deviation directly as input to calculate their ratio: this one calculates those two quantities themselves, from a sample's raw values, a step generally needed upstream of many other statistical calculations, including our confidence interval calculator, which specifically requires a sample standard deviation as input.
Example: the values 2, 4, 4, 4, 5
Inputs
Values: 2, 4, 4, 4, 5.
Calculation
Mean = (2+4+4+4+5) ÷ 5 = 19 ÷ 5 = 3.8. Sum of squared deviations = (2−3.8)²+(4−3.8)²+(4−3.8)²+(4−3.8)²+(5−3.8)² = 3.24+0.04+0.04+0.04+1.44 = 4.8. Variance = 4.8 ÷ (5−1) = 1.2. Standard deviation = √1.2 ≈ 1.0954.
Result
This sample has a mean of 3.8, a variance of about 1.2, and a standard deviation of about 1.10.
Frequently asked questions
Why divide by (n−1) rather than n?
Because the mean used in the calculation is itself estimated from the same data, which introduces a slight bias that tends to underestimate the true population variance if you simply divided by n. Dividing by (n−1) corrects this statistical bias (Bessel's correction), making the sample variance estimate unbiased on average across many different samples drawn from the same population.
What happens if every value in the sample is identical?
In that case, each value exactly equals the mean, so each deviation from the mean is zero: the sum of squared deviations is zero, and consequently the variance and standard deviation are themselves exactly zero. This correctly reflects the complete absence of spread in a perfectly constant sample.
Should I use this formula or the population variance formula?
Use the sample variance (denominator n−1, the one used by this calculator) whenever your data represents a subset of a larger population, the most common situation. The population variance (denominator n, no correction) is only used in the rarer case where the data covers the entire population being studied, with no sampling uncertainty to correct for.