01
How to calculate standard deviation
- Find the mean of the numbers.
- Subtract the mean from each number and square the result.
- Add the squares up.
- Divide by n − 1 for a sample, or by n for a whole population. This is the variance.
- Take the square root.
02
Standard deviation formulas
sample: s = √( Σ(x − x̄)² ÷ (n − 1) )
population: σ = √( Σ(x − μ)² ÷ n )
Dividing by n − 1 (Bessel’s correction) makes up for the fact that a sample’s values sit closer to their own mean than to the true population mean.
03
Worked example
The calculator opens with 2, 4, 4, 4, 5, 5, 7, 9. The mean is 40 ÷ 8 = 5. The squared differences are 9, 1, 1, 1, 0, 0, 4 and 16, which add up to 32.
| Divide 32 by | Variance | Standard deviation | |
|---|---|---|---|
| Population | 8 | 4 | 2 |
| Sample | 7 | 4.5714 | 2.1381 |
04
Sample or population?
Use the sample formula when your numbers are some members of a larger group and you want to describe that group: the usual case in experiments and surveys, and what Excel’s STDEV.S and most statistics software report. Use the population formula (STDEV.P) only when you have every member of the group, such as the marks of all students in one class.
05
Standard deviation vs standard error
The standard deviation describes how much individual values vary. The standard error of the mean describes how precisely the mean is known, and shrinks as the sample grows:
SEM = s ÷ √n
Say which one your error bars show. To compare the means of two groups, use the t-test calculator.
06
Confidence interval of the mean
mean ± t × SEM, with t from the t distribution on n − 1 degrees of freedom
The calculator lists the 90%, 95% and 99% intervals. For the example above (n = 8, SEM = 0.7559) the 95% multiplier is t = 2.365, giving 5 ± 1.787, or 3.21 to 6.79.
Many calculators use the normal value 1.96 whatever the sample size, which gives ± 1.482 here: too narrow for eight values. The two only agree for large samples.
07
Coefficient of variation
CV = s ÷ |mean| × 100%
The CV expresses spread relative to the mean, which lets you compare variability between measurements on different scales, such as assay repeatability at low and high concentrations. It is not meaningful when the mean is close to zero.
08
Standard deviation mistakes that change the result
- Using the population formula on a sample. Dividing by 8 instead of 7 gives 2 instead of 2.1381 for the opening data; the sample SD is 6.9% larger at n = 8 and 22.5% larger at n = 3.
- Reporting the SEM as the SD. For the opening data the SEM is 0.756, √8 = 2.83 times smaller than the SD of 2.1381, so error bars look 2.83 times tighter.
- Confusing variance with SD. The sample variance of the opening data is 4.5714 in squared units; the SD, 2.1381, is in the units of the data.
Trust
How this page is checked
- The calculation runs on code with automated tests against worked reference values. Every number in the examples on this page was produced by that same code, not typed by hand.
- The formulas and conventions used are stated on the page, so you can reproduce the result yourself or compare it with your own software.
- Last reviewed by the Sciloom team, Zebra Nine Studio Inc. It is a tool for research and teaching, not a substitute for a statistician, a validated lab method or medical advice.
Cite this page
Sciloom. (2026). Standard deviation calculator. Zebra Nine Studio Inc. https://sciloom.si/standard-deviation-calculator
Frequently asked questions
How do I find the standard deviation of a data set?
Paste the numbers into the calculator. It finds the mean, squares each difference from the mean, averages those squares (dividing by n − 1 for a sample) and takes the square root.
Should I divide by n or n − 1?
Divide by n − 1 when the data are a sample from a larger population, which is the usual case. Divide by n only when the data are the entire population.
What is the difference between variance and standard deviation?
The standard deviation is the square root of the variance. It is in the same units as the data, which makes it easier to interpret.
Can the standard deviation be zero or negative?
It is zero when all values are identical and can never be negative.