Standard Deviation Calculator

Calculate the sample or population standard deviation of a data set — together with the variance, mean, range and standard error — with every step shown, every observation’s contribution tabulated, and the result verified by a second, independent algorithm.

Sample + population Step-by-step Independently verified Full audit table Runs locally

Calculator

Your data is…
Separate values with commas, spaces, tabs, semicolons or line breaks. Use “.” as the decimal separator (“1,25” is two values). Negative numbers, zero and scientific notation (1.5e3) all work. Your data never leaves this browser.
Changes only how results are displayed and exported. Internal calculations are never rounded.

Result summary

Sample standard deviation (s)2.1380899353
Verified
Variance (s²)
4.57142857143
Mean (x̄)
5
Count (n)
8
Sum (Σx)
40
Minimum
2
Maximum
9
Range
7
SS — sum of squared deviations from the mean (SS)
32
Standard error of the mean (SEM = s / √n)
0.755928946018

Sample vs population — same dataset, both conventions

Sample versus population results computed from the same dataset; the selected mode is marked in the header
QuantitySample (selected)Population
Denominatorn − 1 = 7n = 8
Variance4.571428571434
Standard deviation2.13808993532

Same dataset, same sum of squared deviations — only the denominator differs. The sample figure is always slightly larger (Bessel’s correction).

Calculation audit table

Every observation’s contribution to the result — audit any row by hand.

Per-observation contributions: value, deviation from the mean, and squared deviation
#Value xᵢxᵢ − mean(xᵢ − mean)²
12-39
24-11
34-11
44-11
5500
6500
7724
89416
Σx = 40Σ(x − mean) = 0 ≈ 0Σ(x − mean)² = 32

Step-by-step calculation

Generated from the dataset above — not a canned example.

  1. Count the observations: n = 8.
  2. Find the mean: x̄ = Σx / n = 40 / 8 = 5.
  3. Find each deviation from the mean, xᵢ − x̄ (they always sum to ≈ 0; observed 0).
  4. Square each deviation and sum: Σ(xᵢ − x̄)² = 32.
  5. Choose the denominator: sample data → Bessel’s correction, n − 1 = 7.
  6. Divide: variance = 32 / 7 = 4.57142857.
  7. Take the square root: s = √4.57142857 = 2.13808994.

Independent verification

The primary result (Welford’s algorithm) is re-derived by a second, fully independent compensated two-pass algorithm. The observed difference is shown — never assumed.

Verification receipt — audit trail
Selected method
Sample standard deviation (s)
Denominator
n − 1 = 7
Primary algorithm
Welford's online algorithm (single stable pass)
Independent algorithm
Compensated two-pass (Neumaier summation)
Primary result
2.138089935299395
Independently calculated result
2.138089935299395
Absolute difference
0 (bit-for-bit identical)
Relative difference
0
Tolerance
1.137e-13 (relative) — 64 × machine epsilon (2^−52) × n, relative to the result magnitude
Verification status
Verified
Σ(xᵢ − x̄) check
0 (exact) ≈ 0, within 1.023e-12 ✓
Variance × denominator
32 recovers Σ(xᵢ − x̄)² = 32
Engine
math-solvers v1.5.0

Spread map

Spread map: min, mean ± 1 standard deviation, maxA horizontal axis from 1.58 to 9.42 marking the minimum 2, the mean 5, one standard deviation below and above the mean (2.8619100647 and 7.1380899353), and the maximum 9. This is a position map of your data, not a probability distribution.min 2max 9mean 5mean − 1s = 2.8619100647mean + 1s = 7.1380899353

Position map only — it shows where the mean and ±1 selected standard deviation sit between your minimum and maximum. It is not a normal-distribution curve and implies nothing about the shape of your data.

Standard deviation formulas

Sample standard deviation formula

s = √[ Σ(xᵢ − x̄)² / (n − 1) ]

Where s is the sample standard deviation, xᵢ is each observation, (x-bar) is the sample mean, n is the number of observations, and Σ means “sum over all observations”. The denominator n − 1 is Bessel’s correction: deviations are measured from the sample’s own mean, which uses up one degree of freedom and would otherwise bias the spread estimate low.

Population standard deviation formula

σ = √[ Σ(xᵢ − μ)² / N ]

Where σ (sigma) is the population standard deviation, μ (mu) is the population mean, and N is the size of the complete population. Because the data set is the entire population, no correction is needed and the denominator is N itself.

Computational (shortcut) formula

σ² = [ Σxᵢ² − (Σxᵢ)² / N ] / N

Textbooks often teach this algebraically equivalent “shortcut” because it needs only two running totals (Σx and Σx²) on paper. In floating-point arithmetic, however, subtracting two large, nearly equal totals can cancel catastrophically and destroy precision — a dataset like 1 000 000 000 000 ± 2 breaks it badly. CalcDomain does not use the shortcut formula for computation. This page computes with Welford’s numerically stable one-pass algorithm and verifies the result with an independent compensated two-pass method; the shortcut form is shown here only because you will meet it in textbooks.

How to calculate standard deviation by hand

Use the same dataset the calculator loads as its example — 2, 4, 4, 4, 5, 5, 7, 9 — and work through the definition once by hand. (This doubles as this page’s worked example: load it above and the audit table reproduces every line.)

  1. Mean: Σx = 2 + 4 + 4 + 4 + 5 + 5 + 7 + 9 = 40, and n = 8, so the mean is 40 ÷ 8 = 5.
  2. Deviations: subtract the mean from each value: −3, −1, −1, −1, 0, 0, 2, 4. (They sum to 0 — a built-in check.)
  3. Squared deviations: 9, 1, 1, 1, 0, 0, 4, 16.
  4. Sum of squares: SS = 9 + 1 + 1 + 1 + 0 + 0 + 4 + 16 = 32.
  5. Denominator: treating the eight values as a whole population, divide by N = 8. (As a sample you would divide by n − 1 = 7.)
  6. Variance: σ² = 32 ÷ 8 = 4 (sample: s² = 32 ÷ 7 ≈ 4.5714).
  7. Square root: σ = √4 = 2 (sample: s ≈ 2.1381).

Sample vs population standard deviation

How to calculate standard deviation depends on one question: is this data set everything, or a slice of something bigger? If you measured every unit of interest — every student in the class you are describing, every machine on the line — you have a population and divide the sum of squared deviations by n. If your numbers stand in for a larger group — a survey, a lab sample, a week of a process that runs all year — you have a sample and divide by n − 1.

The correction exists because a sample’s deviations are measured from its own mean rather than the true population mean, which makes them systematically a little too small. Dividing by n − 1 instead of n compensates, so the sample standard deviation is always slightly larger than the population figure on the same data — you can see both side by side in the comparison table above. As n grows, the two converge.

The symbols track the choice: s and (with mean x̄) for samples, σ and σ² (with mean μ) for populations. A sample of one value has no defined standard deviation at all: n − 1 = 0, so this calculator rejects it rather than inventing a number.

What does standard deviation tell you?

Standard deviation answers “how far do values typically sit from the mean?” — in the original units of your data. If the data are centimetres, so is the standard deviation; the variance, by contrast, is in squared units (cm²), which is why the root is the reported figure.

Standard deviation and the 68–95–99.7 rule

For data that are approximately normally distributed, about 68% of values fall within one standard deviation of the mean, about 95% within two, and about 99.7% within three — the “empirical rule”.

The 68–95–99.7 rule applies to data that are approximately normally distributed. Standard deviation itself does not require a normal distribution — it is defined for any numeric dataset. Skewed, bimodal or heavy-tailed data have a perfectly valid standard deviation, but the 68/95/99.7 percentages will not hold for them. This page computes your standard deviation without assuming any distribution, and its spread map shows positions, not a bell curve.

Standard deviation vs variance

Comparison of standard deviation and variance
Standard deviationVariance
Formula√[ Σ(xᵢ − x̄)² / (n − 1) ] (sample)Σ(xᵢ − x̄)² / (n − 1) (sample)
UnitsSame units as the data (e.g. cm)Squared units (e.g. cm²)
InterpretationTypical distance of a value from the meanAverage squared distance from the mean; central to ANOVA and regression algebra
Sample symbols
Population symbolσσ²

The two are one square root apart: SD = √variance. Report the standard deviation when you want a human-readable spread; keep the variance when you need to add spreads of independent quantities, because variances add and standard deviations do not.

Standard deviation vs standard error

SD → variability among observations SEM → uncertainty of the estimated sample mean SEM = s / √n

The standard deviation describes the data: how much individual observations vary. The standard error of the mean describes an estimate: how uncertain the sample mean is as a stand-in for the population mean. Collect more data and the SD settles toward a stable value while the SEM keeps shrinking with √n — which is why error bars of the two kinds look so different on the same measurements.

This calculator reports SEM only in sample mode. When you declare the dataset a complete population, its mean is not an estimate of anything, so a standard error is not applicable — the result panel says so explicitly rather than printing a misleading number.

Reproduce this standard deviation

A result you can’t reproduce is a number you have to trust. Check this page’s output in the tool you already use — put the data in a column/list called A1:A8, data or x and run:

Excel / Google Sheets
=STDEV.S(A1:A8)   — sample (divides by n − 1)
=STDEV.P(A1:A8)   — population (divides by n)
Python (statistics module)
from statistics import stdev, pstdev

stdev(data)    # sample (n − 1)
pstdev(data)   # population (n)
NumPy
np.std(data, ddof=1)   # sample (n − 1)
np.std(data, ddof=0)   # population (n, NumPy default)
R
sd(x)                            # sample (n − 1)
sqrt(mean((x - mean(x))^2))      # population (n)

Different software defaults to different denominators. Always verify whether the function uses n or n − 1. Excel’s and Google Sheets’ STDEV/STDEV.S and R’s sd() are sample functions (n − 1); NumPy’s np.std() defaults to the population convention (ddof=0); Python’s statistics module makes you choose explicitly.

Frequently asked questions

What is standard deviation?

Standard deviation measures how spread out a data set is around its mean, in the same units as the data. A small standard deviation means the values cluster near the mean; a large one means they are widely scattered. It is defined as the square root of the variance.

How do you calculate standard deviation?

Count the observations, find the mean, subtract the mean from each value, square each deviation and sum them. Divide that sum by n − 1 for a sample (or n for a population) to get the variance, then take the square root. This calculator shows each of those steps with your own numbers.

What is the standard deviation formula?

For a sample: s = √[ Σ(xᵢ − x̄)² / (n − 1) ]. For a population: σ = √[ Σ(xᵢ − μ)² / N ]. In both, the numerator is the sum of squared deviations from the mean; only the denominator differs.

What is the difference between sample and population standard deviation?

The population formula divides the sum of squared deviations by n because the data set is complete. The sample formula divides by n − 1 (Bessel’s correction) because a sample’s deviations are measured from its own mean, which systematically understates the spread of the wider population. Sample SD is therefore always slightly larger on the same data.

When should I divide by n − 1?

Divide by n − 1 whenever your data is a sample drawn from a larger population and you want to estimate that population’s spread — which covers most real measurements, surveys and experiments. Divide by n only when your data set is the entire population of interest, fully enumerated.

What does a standard deviation of zero mean?

Every value in the data set is identical. Zero is the smallest possible standard deviation: there are no deviations from the mean at all, so the variance and standard deviation are exactly 0.

Can standard deviation be greater than the mean?

Yes. The two are independent quantities: a data set like 1, 2, 100 has a mean of about 34 and a larger standard deviation. Data containing zero or negative values can even have a positive standard deviation with a mean of zero. A ratio above 1 simply signals high relative spread.

Can standard deviation be negative?

No. It is the square root of a sum of squared terms divided by a positive count, so it is always zero or positive. A negative result always indicates a calculation error.

What is the difference between variance and standard deviation?

Variance is the average squared deviation from the mean, so it is expressed in squared units (e.g. cm²). Standard deviation is its square root, back in the original units (cm), which is why it is the figure usually reported. Numerically, SD = √variance.

What is the difference between standard deviation and standard error?

Standard deviation describes the variability among individual observations. The standard error of the mean (SEM = s / √n) describes the uncertainty of the estimated sample mean, and it shrinks as the sample grows. This calculator reports SEM only in sample mode, because for a fully enumerated population the mean is not an estimate.

Does standard deviation require normally distributed data?

No. Standard deviation is defined for any numeric data set regardless of its distribution. Only distribution-specific interpretations — such as the 68–95–99.7 rule — assume approximate normality.

How do Excel and Google Sheets calculate standard deviation?

Both use the same formulas as this page: STDEV.S (and the older STDEV) divides by n − 1 for a sample; STDEV.P divides by n for a population. To reproduce this calculator’s result, put your data in a column and use =STDEV.S(range) or =STDEV.P(range) to match the mode you selected.

Why can’t sample standard deviation be calculated from one value?

The sample formula divides by n − 1, which is zero when n = 1, so the result is undefined — one observation carries no information about spread. This calculator returns a clear error in sample mode and requires at least two values; population mode reports 0 for a single value.

Methodology and verification

The mean and the sum of squared deviations are computed in one numerically stable pass with Welford’s online algorithm (Welford, Technometrics, 1962), never with the cancellation-prone shortcut Σx² − (Σx)²/n. The sum of squared deviations is divided by n (population) or n − 1 (sample, Bessel’s correction) to give the variance, whose square root is the standard deviation; the standard error s/√n is reported for samples only. Every result is independently re-derived by a compensated (Neumaier) two-pass computation, and the receipt shows the observed difference between the two algorithms against a documented tolerance scaled to machine epsilon and n. No intermediate rounding is applied; formatting happens only at display time. Empty input, non-numeric tokens (named in the error) and a sample of fewer than two values fail closed with structured errors.

Engine: math-solvers v1.5.0 · Author: Ugo Candido · Last updated: · Every calculation runs locally in this browser — no dataset, result or receipt is ever transmitted to a server. The software verification above runs on every single calculation; browse more tools on the Math page.

Sources

Methodological references for the definitions, the algorithm and the software reproduction section (these document the method — they are not input datasets):

Related calculators