CalcPerks
Math

Standard Deviation Calculator

Population and sample standard deviation, plus variance.

Paste your numbers separated by commas, spaces or new lines, then choose whether they are a full population or a sample drawn from one.

Sample standard deviation (s)
2.1381
√(32 ÷ 7)
Sample variance (s²)4.5714
Mean5
Sum of squares Σ(x − x̄)²32
Count8
Sum40
Population σ2
Sample s2.1381
Mean = 40 ÷ 8 = 5. Squaring each deviation from that mean and adding gives 32, so variance = 32 ÷ 7 = 4.5714 and the standard deviation is its square root, 2.1381. Values range from 2 to 9.

How to use this calculator#

  1. Paste your values and confirm the countCommas, spaces and new lines all separate values. Because every deviation is squared, one mistyped digit affects standard deviation far more than it affects the mean — check n before you read anything else.
  2. Decide whether the list is a population or a sampleA population is every member of the group you are describing. A sample is a subset you are using to estimate a larger group. Almost all real measurement is sampling, so n − 1 is the usual choice.
  3. Read the variance as well as the standard deviationVariance is in squared units and is what adds up when you combine independent sources of variation. Standard deviation is its square root and is the only one directly comparable to the mean.
  4. Compare the standard deviation to the meanA standard deviation of 3 is tiny next to a mean of 500 and enormous next to a mean of 4. Dividing one by the other gives the coefficient of variation, which is how you compare spread across different scales.

The formula#

Population and sample standard deviation

σ = √( Σ(xᵢ − μ)² ÷ N ) • s = √( Σ(xᵢ − x̄)² ÷ (n − 1) )

σ
Population standard deviation (lower-case sigma)
s
Sample standard deviation
xᵢ
Each individual value in the list
μ
Population mean (mu) — the mean of every member of the group
Sample mean — the mean of the values you actually measured
N
Size of the whole population
n
Size of the sample; the divisor is n − 1, the degrees of freedom
Σ
Sum over every value in the list

The only difference between the two formulas is the divisor: N for a population, n − 1 for a sample. A sample's own mean sits closer to its own values than the true population mean does, so the squared deviations come out systematically too small. Dividing by n − 1 instead of n inflates the result just enough to correct that bias — this is Bessel's correction, and it makes s² an unbiased estimator of the population variance. It matters most on small samples: at n = 5 it raises the answer by 11.8%, at n = 100 by only 0.5%.

Population versus sample standard deviation#

Both start identically: find the mean, subtract it from every value, square each difference and add them up. The split comes at the end — population standard deviation divides that sum of squares by N, while sample standard deviation divides by n − 1. That n − 1, known as Bessel's correction, offsets the tendency of a small sample to understate the true spread. Using N on sample data quietly reports a number that is too small.

A fully worked example#

Take the values 2, 4, 4, 4, 5, 5, 7 and 9. The mean is 40 ÷ 8 = 5. The squared differences are 9, 1, 1, 1, 0, 0, 4 and 16, which sum to 32. Population variance is 32 ÷ 8 = 4, so the population standard deviation is the square root of 4, which is 2. Treated as a sample, the variance is 32 ÷ 7 = 4.571 and the standard deviation is 2.14.

Reading the number you get#

Standard deviation is expressed in the same units as your data, which makes it directly comparable to the mean. For roughly bell-shaped data, about 68% of values sit within one standard deviation of the mean and about 95% within two. A value near zero means the data is tightly clustered; a standard deviation approaching the size of the mean itself signals very high variability.

Worked examples#

A full calculation, both ways

The eight values 2, 4, 4, 4, 5, 5, 7, 9.

  1. Mean = (2 + 4 + 4 + 4 + 5 + 5 + 7 + 9) ÷ 8 = 40 ÷ 8 = 5
  2. Deviations from the mean: −3, −1, −1, −1, 0, 0, 2, 4
  3. Squared: 9, 1, 1, 1, 0, 0, 4, 16 — sum of squares = 32
  4. Population: variance = 32 ÷ 8 = 4, so σ = √4 = 2
  5. Sample: variance = 32 ÷ (8 − 1) = 32 ÷ 7 = 4.5714, so s = √4.5714 = 2.14

σ = 2.00 and s = 2.14 from identical data. The 7% gap comes entirely from the choice of divisor.

Five measured heights, treated as a sample

Heights in centimetres of five people drawn from a much larger group: 165, 170, 172, 178, 185.

  1. Mean = 870 ÷ 5 = 174
  2. Deviations: −9, −4, −2, 4, 11
  3. Squared: 81, 16, 4, 16, 121 — sum of squares = 238
  4. Sample variance = 238 ÷ 4 = 59.5, so s = √59.5 = 7.71 cm
  5. For comparison, the population formula gives 238 ÷ 5 = 47.6 and σ = 6.90 cm
  6. Coefficient of variation = 7.71 ÷ 174 = 4.4%

s = 7.71 cm. Using N here would report 6.90 cm — an 11.8% understatement of the spread, which is exactly the penalty for using the wrong divisor at n = 5.

Reference tables#

How much of the data sits within each distance of the meanFor a normal (bell-shaped) distribution. The 1, 2 and 3 sigma rows are the empirical rule.
Distance from meanProportion insideProportion outsideRoughly
±1σ68.27%31.73%1 value in 3 falls outside
±1.645σ90.00%10.00%1 in 10
±1.960σ95.00%5.00%1 in 20 — the basis of a 95% confidence interval
±2σ95.45%4.55%1 in 22
±2.576σ99.00%1.00%1 in 100
±3σ99.73%0.27%1 in 370
±4σ99.9937%0.0063%1 in 15,787
±6σ99.9999998%0.0000002%about 1 in 507 million

These proportions only hold for roughly normal data. On skewed or heavy-tailed data — incomes, latencies, insurance claims — far more than 0.27% of observations sit beyond 3σ, which is why percentiles are preferred there.

What Bessel's correction actually changesThe sample standard deviation divided by the population figure from the same numbers: √(n ÷ (n − 1)).
Sample size ns ÷ σs is larger by
21.414241.4%
31.224722.5%
51.118011.8%
101.05415.4%
201.02602.6%
301.01711.7%
501.01021.0%
1001.00500.5%
1,0001.00050.05%

Past about n = 100 the choice barely matters numerically. Below n = 20 it is the difference between a defensible figure and a misleading one.

Which divisor should you useThe question is always whether your numbers are the whole group or a stand-in for one.
Your dataUseDivisor
Every student's score in one class, and that class is all you are describingPopulation σN
20 light bulbs tested from a production run of 50,000Sample sn − 1
The recorded populations of all 50 US statesPopulation σN
30 days of server latency, used to predict next monthSample sn − 1
Excel and Google Sheets STDEV.S, STDEV, STDEVASample sn − 1
Excel STDEV.P / STDEVP, and NumPy np.std() with its default ddof=0Population σN

The NumPy default is the one that catches people out: np.std(x) returns the population figure, and you need np.std(x, ddof=1) to match Excel's STDEV.S and most statistics textbooks.

Common mistakes#

  • Using the population formula on sample dataDividing by N when your numbers are a sample reports a spread that is systematically too small — 11.8% too small at n = 5, 5.4% at n = 10. Every downstream confidence interval and error bar built on it is then too narrow, which is how a result gets called significant when it is not.
  • Confusing standard deviation with standard errorStandard deviation describes how spread out individual values are. Standard error, s ÷ √n, describes how precisely you know the mean, and shrinks as you collect more data. Quoting the standard error as if it were the spread makes any dataset look far tighter than it is.
  • Comparing standard deviations across different scalesAn SD of 12 on exam marks out of 100 and an SD of 12 on salaries in thousands describe wildly different variability. Divide by the mean to get the coefficient of variation before comparing — 12 on a mean of 60 is 20%, while 12 on a mean of 45,000 is 0.027%.
  • Applying the 68–95–99.7 rule to skewed dataThe empirical rule is a property of the normal distribution, not of standard deviation itself. On response times or income, the mean plus one SD can easily sit above the 80th percentile, and ‘three sigma events’ turn up monthly rather than once every few years.

Frequently asked questions#

Should I use population or sample standard deviation?

Use population when your list is every member of the group you care about. Use sample when the numbers are a subset you are using to estimate a larger group — that is the more common case.

What is the difference between variance and standard deviation?

Variance is the average squared deviation from the mean. Standard deviation is its square root, which returns the figure to the original units and makes it interpretable.

What does a standard deviation of zero mean?

Every value in the list is identical, so there is no spread at all around the mean.

How many numbers do I need?

Population standard deviation needs at least one value; sample standard deviation needs at least two, because dividing by n − 1 is undefined for a single observation.

Key terms#

Variance
The mean of the squared deviations from the mean. Expressed in squared units, so a variance of 4 cm² corresponds to a standard deviation of 2 cm.
Standard deviation
The square root of the variance, back in the original units and therefore directly comparable to the mean.
Bessel's correction
Dividing by n − 1 instead of n when calculating a sample variance, which removes the downward bias caused by using the sample's own mean.
Degrees of freedom
The number of values free to vary once the mean is fixed — n − 1, because the last value is determined by the others and the mean.
Standard error of the mean
s ÷ √n. How much the sample mean itself would wobble if you repeated the study. Not a measure of the spread of the data.
Coefficient of variation
Standard deviation divided by the mean, usually as a percentage. The scale-free way to compare variability between different quantities.
z-score
(x − mean) ÷ standard deviation. How many standard deviations a single value sits from the mean, positive above and negative below.
Sum of squares
Σ(x − mean)², the quantity both formulas share. All the work is in computing it; the divisor is the last decision.

Sources#

Put this calculator on your site

Free, no sign-up, and no attribution fee — just keep the credit line that comes with the code. The calculator stays up to date automatically.

Preview the embed →