Standard deviation measures how far the values in a data set typically sit from their mean, in the same units as the data. Square each value’s distance from the mean, add the squares, divide by n − 1 for a sample or by N for a whole population, then take the square root.
A small standard deviation means the values cluster near the mean; a large one means they are spread out. Two data sets can share a mean and still differ a lot in spread, which is why the mean on its own rarely tells you enough.
What is the standard deviation?
It is the typical distance between a value and the mean of its data set. NIST’s Engineering Statistics Handbook calls the variance “roughly the arithmetic average of the squared distance from the mean” and the standard deviation its square root, which “restores the units of the spread to the original data units (the variance squares the units).” Measure spending in dollars and the standard deviation is in dollars; the variance is in dollars squared.
The Greek letter σ is used for a population and the Latin s for a sample. Python’s statistics module follows the same split: its sample function takes the sample mean as xbar and its population function takes the population mean as mu.
| Symbol | What it stands for |
|---|---|
| σ (sigma) | Population standard deviation |
| s | Sample standard deviation |
| μ (mu) | Population mean |
| x (x-bar) | Sample mean |
| N, n | Number of values in the population, in the sample |
| σ2, s2 | Population variance, sample variance |
What is the standard deviation formula?
There are two versions, and they differ only in what you divide by.

Sample: s = √[ Σ(xi − x)2 / (n − 1) ]
Population: σ = √[ Σ(xi − μ)2 / N ]
Sample or population: which formula should you use?
Use the population formula only when your data hold every member of the group you care about. Use the sample formula when the data stand in for a larger group, which is the usual case. Microsoft’s documentation for STDEV.S draws the same line: the function “assumes that its arguments are a sample of the population. If your data represents the entire population, then compute the standard deviation using STDEV.P.”
Why divide by n − 1?
The sample mean is worked out from the same numbers, so the squared distances to it come out a little too small on average. NumPy’s documentation says the N − 1 divisor “corrects for bias (toward lower values) in the variance estimate” that comes from using the sample mean in place of the true mean of the population. The usual name for it is Bessel’s correction.
The correction matters most when samples are small. With five values it multiplies the variance by 5/4 and the standard deviation by about 1.118 (our calculation). With thousands of values it barely moves the result: Microsoft notes that “for large sample sizes, STDEV.S and STDEV.P return approximately equal values.”
How do we calculate standard deviation?
- Find the mean. Add the values and divide by how many there are.
- Subtract the mean from each value. These differences are the deviations; some are negative.
- Square each deviation. Every term turns positive and big gaps count for more: in NIST’s words, “a point 2 units from the mean adds 4 to the above sum while a point 10 units from the mean adds 100 to the sum.”
- Add the squared deviations.
- Divide by n − 1 for a sample, or by N for a population. The result is the variance.
- Take the square root. That is the standard deviation.
Calculation example
Someone writes down what they spend on eating out over five working days and wants to know how much it swings from day to day. Those five days stand in for their habits in general, so the sample formula fits. The population figure is shown as well: it is the right one if you only want to describe this one week.
| Day | Spent ($) | x − x | (x − x)2 |
|---|---|---|---|
| Monday | 10 | −4 | 16 |
| Tuesday | 5 | −9 | 81 |
| Wednesday | 20 | 6 | 36 |
| Thursday | 15 | 1 | 1 |
| Friday | 20 | 6 | 36 |
| Total | 70 | 0 | 170 |
- Mean: 70 ÷ 5 = $14.
- Sum of squared deviations: 170.
- Sample variance: 170 ÷ 4 = 42.5 dollars squared. Sample standard deviation: s = √42.5 = $6.52.
- Population variance: 170 ÷ 5 = 34 dollars squared. Population standard deviation: σ = √34 = $5.83.
How to read it: on a typical day this person spends about $6.50 more or less than $14. Four of the five days land between $7.48 and $20.52; only Tuesday falls outside. Do not look for the 68% figure here: that rule describes a normal distribution, and five numbers are far too few to show a shape.
Standard deviation in Excel, Google Sheets, Python, R and the TI-84
Each tool below can give you either version, though R needs a one-line rescale for the population figure. They do not agree on which one you get by default, and that alone can give two people different answers from the same numbers.
| Tool | Sample (n − 1) | Population (N) |
|---|---|---|
| Excel | STDEV.S | STDEV.P |
| Google Sheets | STDEV or STDEV.S | STDEVP or STDEV.P |
| Python statistics | stdev() | pstdev() |
| NumPy | std(x, ddof=1) | std(x), the default |
| pandas | .std(), the default | .std(ddof=0) |
| R | sd(x) | sd(x) × √((n − 1)/n) |
| TI-84 Plus | Sx | σx |
The trap is NumPy against pandas. We ran the five days above on 13 October 2026: numpy.std() (NumPy 2.4.6) returned 5.8310 and pandas.Series.std() (pandas 3.0.6) returned 6.5192. NumPy’s docs say “By default ddof is zero”, so numpy.std divides by N, while pandas is “Normalized by N-1 by default.” Python’s own statistics.stdev and pstdev returned the same 6.5192 and 5.8310. If a notebook and a spreadsheet disagree, check the divisor first.
- Excel: STDEV.S uses “the ‘n-1’ method” and STDEV.P “the ‘n’ method”. The older STDEV still works but is kept “for backward compatibility”.
- Google Sheets: STDEV “calculates the standard deviation based on a sample”; STDEVP uses the entire population. The function list maps STDEV.S and STDEV.P onto them, so Excel formulas carry over.
- R: sd() “uses denominator n – 1”.
- TI-84 Plus: Texas Instruments explains that the population figure, “denoted by σx, divides the calculated values by n”, and the sample figure, “denoted by Sx, uses the value n-1 as the denominator”. Both are filled in when you run a 1-Var Stats analysis.
- Our standard deviation calculator has one button for each version.
What does variance mean?
Variance is the spread before the square root: the sum of squared deviations divided by n − 1 (sample, s2) or N (population, σ2). In the example it is 42.5 or 34, in dollars squared. Because the deviations are squared, NIST warns that the variance “can be greatly affected by the tail behavior”: one far-out value can dominate it.
Difference between standard deviation and variance
| Standard deviation | Variance | |
|---|---|---|
| Units | Same as the data ($) | Squared ($2) |
| Relationship | Square root of variance | Standard deviation squared |
| Example (sample) | $6.52 | 42.5 |
| Best for | Describing spread | Combining spreads |
Variance earns its place in the algebra: for independent quantities, variances add while standard deviations do not. MIT’s Mathematics for Computer Science notes put it as σ(R1 + R2)2 = σ(R1)2 + σ(R2)2 when the two are independent. King’s combined safety stock formula (below) works the same way: when demand and lead-time variability are independent, safety stock is “Z-score times the square root of the sum of the squares of the individual variabilities.”
What does a standard deviation graph show?
For a normal, bell-shaped distribution the share of values within a given number of standard deviations is fixed: 68.27% within one, 95.45% within two and 99.73% within three. These come from NIST’s standard normal table (areas of 0.34134, 0.47725 and 0.49865 on each side of the mean, doubled). NIST’s control-chart chapter uses the same fact: “the 3σ in one direction is 0.00135, or in both directions 0.0027.”
Those figures hold only for normal data. For any distribution at all, Chebyshev’s inequality gives a floor instead: at most 1/k2 of the values lie k or more standard deviations from the mean (MIT 6.1200J, lecture 24). So at least 75% lie within two standard deviations and at least 88.9% within three (our calculation). Altman and Bland, writing in the BMJ, add that “the standard deviation is a valid measure of variability regardless of the distribution.” They also note: “About 95% of observations of any distribution usually fall within the 2 standard deviation limits, though those outside may all be at one end.”
How do we use standard deviation in different situations?
Quality control: control limits and process capability
Control charts set their limits a fixed number of standard deviations from the center line. NIST: “it is an acceptable practice to base the control limits upon a multiple of the standard deviation. Usually this multiple is 3 and thus the limits are called 3-sigma limits.” The process capability index compares the specification width with six standard deviations: Cp = (USL − LSL) / 6σ. For normally distributed data, NIST’s table translates Cp = 1.00 into 0.27% rejects and Cp = 1.33 into 64 parts per million. More on charts in our guide to statistical process control.
Inventory: sizing safety stock
Peter King’s APICS article on safety stock sums up the demand-driven case: the safety stock needed “simply is the standard deviation of demand variability multiplied by the Z-score”. For a 95% cycle service level that Z-score is 1.65. When the lead time is longer than the period the standard deviation was measured over, it is scaled by the square root of the ratio: weekly data and a three-week lead time means multiplying by √3.
Our calculation with illustrative numbers: weekly demand with a standard deviation of 40 units and a three-week lead time gives 1.65 × 40 × √3 = 114.3, so about 115 units of safety stock. The target inventory level guide works the full formula, including the review period.
Finance: volatility
In investing, volatility is the standard deviation of returns. A fund prospectus filed with the SEC by AQR Funds defines it as “a statistical measurement of the dispersion of returns of a security or fund or index, as measured by the annualized standard deviation of its returns.”
Comparing spreads on different scales
A standard deviation of 25 is large for a mean of 50 and small for a mean of 1,000. To compare, divide by the mean. NIST’s Dataplot manual defines the coefficient of variation as standard deviation / mean, and the relative standard deviation as 100 × (standard deviation / |mean|). Those two series come out at 50% and 2.5%; the spending example at 6.52 / 14 = 46.6% (our calculations).
Standard deviation vs standard error
They answer different questions. Douglas Altman and Martin Bland put it plainly in a BMJ statistics note: “if we want to say how widely scattered some measurements are, we use the standard deviation. If we want to indicate the uncertainty around the estimate of the mean measurement, we quote the standard error of the mean.”
The standard error comes from the standard deviation: “SE = SD/√(sample size)”. For the five days, 6.52 / √5 = 2.92 (our calculation). More data shrinks the standard error. “By contrast the standard deviation will not tend to change as we increase the size of our sample.”
Strengths
- It is in the data’s own units, so it reads plainly: about $6.50 a day either side of the mean.
- It uses every value. The range, by contrast, “is based only on the lowest and highest extreme values” (NIST).
- Variances of independent quantities add, which makes it the building block for control limits and safety stock.
- Excel, Google Sheets, Python, R and the TI-84 all compute it (see the table above).
Limitations
- Outliers pull it hard, because deviations are squared. NIST lists the average absolute deviation as “less affected by extreme observations than are the variance and standard deviation”, and the median absolute deviation as even less affected. For the example they are 5.2 and 5 (our calculation).
- It says nothing about shape. The 68-95-99.7 reading needs normal data; in skewed data the values outside two standard deviations may all sit on one side (BMJ).
- There are two versions. Always say whether you divided by n − 1 or N: with five values the choice alone changes the answer by about 12%.
- It describes the data you have. It is not a forecast of the next value.
FAQs
What is the difference between sample and population standard deviation?
The divisor. The sample standard deviation (s) divides the sum of squared deviations by n − 1; the population standard deviation (σ) divides by N. Use σ only when you have every value in the group, and s when the data stand in for a larger group. For the values 10, 5, 20, 15 and 20, s = 6.52 and σ = 5.83.
Is standard deviation the square root of variance?
Yes. Variance is the sum of squared deviations from the mean divided by n − 1 (sample) or N (population), and the standard deviation is its square root, which puts the spread back into the data’s own units. A variance of 42.5 dollars squared is a standard deviation of $6.52.
What does a high standard deviation mean?
That the values are spread widely around the mean; a low one means they cluster close to it. What counts as high depends on the mean and the context, so to compare data sets with different averages, divide the standard deviation by the mean to get the coefficient of variation.
Why do NumPy and pandas give different standard deviations?
Different defaults. numpy.std divides by N unless you pass ddof=1, while pandas Series.std divides by n − 1 unless you pass ddof=0. On the values 10, 5, 20, 15 and 20, NumPy 2.4.6 returned 5.83 and pandas 3.0.6 returned 6.52.
What is the difference between standard deviation and standard error?
Standard deviation describes how scattered individual values are. Standard error describes how precisely a sample mean estimates the population mean. It equals the standard deviation divided by the square root of the sample size, so it shrinks as the sample grows while the standard deviation does not.
Which standard deviation should you report?
Report the sample standard deviation (n − 1) unless your data are the whole group you care about. Label it s or SD, give the number of values, and say which tool or formula produced it, since the defaults differ. If your point is how precise an average is, report the standard error instead. And never join either one to a mean with a bare ± sign: the BMJ asks authors to “indicate clearly whether the standard deviation or standard error is being quoted.”
How we researched this page (checked 13 October 2026). Definitions and formulas come from the NIST/SEMATECH e-Handbook of Statistical Methods. Spreadsheet, code and calculator behavior comes from Microsoft, Google, Python, NumPy, pandas, R and Texas Instruments documentation, and we ran the NumPy, pandas and Python results ourselves. The standard error is from Altman and Bland (BMJ, 2005) and safety stock from King (APICS Magazine, 2011). The worked example uses illustrative figures, and every result marked as ours can be recomputed from the numbers shown. An earlier version of this page reported only the population result ($5.8) while describing the sample method, and called each deviation a ‘variance’; both are corrected, including in the images.
References
- NIST/SEMATECH e-Handbook of Statistical Methods, 1.3.5.6 Measures of Scale
- NIST/SEMATECH e-Handbook, 1.3.6.6.1 Normal Distribution
- NIST/SEMATECH e-Handbook, 1.3.6.7.1 Cumulative Distribution Function of the Standard Normal Distribution
- NIST/SEMATECH e-Handbook, 6.3.1 What are Control Charts?
- NIST/SEMATECH e-Handbook, 6.1.6 What is Process Capability?
- NIST Dataplot Reference Manual: Coefficient of Variation
- NIST Dataplot Reference Manual: Relative Standard Deviation
- Microsoft Support: STDEV.S function
- Microsoft Support: STDEV.P function
- Microsoft Support: STDEV function
- Google Docs Editors Help: STDEV
- Google Docs Editors Help: STDEVP
- Google Docs Editors Help: Google Sheets function list
- Python documentation: statistics, Mathematical statistics functions
- NumPy manual: numpy.std
- pandas documentation: pandas.Series.std
- R documentation: sd {stats}
- Texas Instruments: Calculating variance on the TI-84 Plus family (Solution 34473)
- Altman DG, Bland JM. Standard deviations and standard errors. BMJ 2005;331:903
- King PL. Crack the Code: Understanding safety stock and mastering its equations. APICS Magazine, July/August 2011
- MIT OpenCourseWare 6.1200J (Spring 2024), Lecture 24: Large Deviations: Chebyshev and Chernoff Bound
- AQR Funds prospectus, SEC filing (prospectus date 1 May 2022)
Using Google Search? Add erp-information.com as a preferred source.





