To calculate standard deviation, find the mean of your dataset, subtract the mean from each value and square the result, average those squared differences, then take the square root. That four-step process gives you a single number that measures how spread out your data is from the center.
Standard deviation is one of the most used statistics in science, finance, and research — and one of the most misunderstood. A standard deviation of 3 on a test tells you something very different from a standard deviation of 3 on a national income dataset. The number only makes sense in context, which is why understanding how to calculate standard deviation from scratch is more useful than just reading the output from software.
Use the free Standard Deviation Calculator at RoughTools to calculate standard deviation instantly for any dataset — or follow the step-by-step method below.
The Standard Deviation Formula
There are two versions: one for a full population and one for a sample drawn from a larger group. The sample formula is more commonly used in practice.
Population standard deviation (σ):
σ = √( Σ(xi − μ)² / N )
Sample standard deviation (s):
s = √( Σ(xi − x̄)² / (n − 1) )
Where:
- xi — each individual value in the dataset
- μ — the population mean (average of all values)
- x̄ — the sample mean
- N — total number of values in the population
- n — number of values in the sample
- n − 1 — Bessel's correction, which adjusts for the fact that a sample tends to underestimate population spread
- Σ — "sum of" (add up all the terms)
Worked example: 5 weekly grocery bills
A household tracks their grocery spending for five weeks: $147, $163, $129, $178, $154. These five weeks are a sample, so use the sample formula.
Step 1 — Calculate the mean:
Mean (x̄) = (147 + 163 + 129 + 178 + 154) / 5
Mean = 771 / 5
Mean = $154.20
Step 2 — Subtract the mean from each value and square the result:
(147 − 154.20)² = (−7.20)² = 51.84
(163 − 154.20)² = (8.80)² = 77.44
(129 − 154.20)² = (−25.20)² = 635.04
(178 − 154.20)² = (23.80)² = 566.44
(154 − 154.20)² = (−0.20)² = 0.04
Step 3 — Sum the squared differences:
51.84 + 77.44 + 635.04 + 566.44 + 0.04 = 1,330.80
Step 4 — Divide by n − 1 and take the square root:
Sample variance = 1,330.80 / (5 − 1) = 1,330.80 / 4 = 332.70
Sample SD = √332.70 ≈ $18.24
The result: a standard deviation of $18.24 means most weekly grocery bills fall within about $18 of the $154.20 average — roughly between $136 and $172. The one outlier ($129) is about 1.4 standard deviations below the mean, which is noticeable but not unusual for a small dataset.
How to Calculate Standard Deviation Step by Step
-
Gather your full dataset and decide whether it is a population or a sample. If you have data for every single member of the group you are studying (every employee at a company, all test scores from a specific class), use the population formula. If your data is a subset drawn from a larger group, use the sample formula. Most real-world analysis uses the sample formula.
-
Calculate the mean by summing all values and dividing by the count. Write out every value before adding — missed values are the most common source of error. For large datasets, group values in sets of five using tally marks to avoid miscounting. Confirm your count n before dividing.
-
Subtract the mean from each individual value to get the deviation. Some deviations will be negative (values below the mean) and some positive. This is expected and correct. When you square them in the next step, all values become positive — negative deviations are not errors.
-
Square each deviation and sum all the squared values. Squaring serves two purposes: it eliminates the sign (positive and negative deviations don't cancel out) and it gives extra weight to values far from the mean. The sum of squared deviations is called the sum of squares (SS) — a term you will see frequently in statistics coursework.
-
Divide by n − 1 (for samples) or N (for population) to get the variance. The variance is standard deviation squared — it is the intermediate result before the final square root. Variance is reported in squared units (dollars squared, degrees squared), which is not intuitive. Taking the square root in the next step converts it back to the original units.
-
Take the square root of the variance to get standard deviation. Verify that your result is smaller than the range of your data and larger than zero. For the grocery example: the range is $178 − $129 = $49, and the standard deviation is $18.24. A standard deviation larger than the range is impossible — that signals an arithmetic error earlier in the process.
Pro tip: Before calculating, write the mean at the top of your work and label each deviation clearly as positive or negative. Students who skip this labeling step frequently lose track of signs and end up with a sum of squared deviations that is far too small or oddly rounded.
What Is the Difference Between Population and Sample Standard Deviation?
Population standard deviation divides by N; sample standard deviation divides by n − 1. That single number in the denominator changes the result — and choosing the wrong one can make your analysis technically incorrect.
The reason for n − 1 in the sample formula is a concept called Bessel's correction. When you take a sample, it tends to cluster near the mean by chance — extreme values are underrepresented. Dividing by n − 1 instead of n slightly inflates the result, correcting for this bias. The smaller your sample, the more significant this correction is.
Here is the practical impact on the grocery example:
| Formula | Denominator | Variance | Standard Deviation | |---|---|---|---| | Population | 5 | 266.16 | $16.31 | | Sample | 4 | 332.70 | $18.24 |
The difference is $1.93 here — not enormous for 5 data points, but meaningful. For a sample of 3, the difference is even larger. For a sample of 1,000, the difference between dividing by 999 versus 1,000 is negligible.
The rule: if you measured every single member of the group (complete census), use population SD. If you took a subset to draw conclusions about a larger group, use sample SD. In most classroom problems, if the question says "sample," divide by n − 1. Most software (Excel's STDEV function, Google Sheets) uses the sample formula by default.
What Does Standard Deviation Tell You About Your Data?
Standard deviation tells you how much individual values typically deviate from the mean. A small standard deviation means the data clusters tightly around the average. A large one means the values are spread out widely.
The most practical way to interpret standard deviation is through the empirical rule (also called the 68-95-99.7 rule), which applies to approximately normal (bell-shaped) distributions:
- Approximately 68% of values fall within 1 standard deviation of the mean
- Approximately 95% fall within 2 standard deviations
- Approximately 99.7% fall within 3 standard deviations
For the grocery example (mean $154.20, SD $18.24):
- 1 SD range: $135.96 to $172.44 — expect about 68% of weekly bills here
- 2 SD range: $117.72 to $190.68 — expect about 95% here
- Any bill below $99 or above $208 would be exceptionally rare (beyond 3 SD)
This is why standard deviation is useful for spotting anomalies. A factory measuring bolt diameter with a mean of 10mm and SD of 0.02mm would flag any bolt below 9.94mm or above 10.06mm as a defect — it falls more than 3 standard deviations from the target. In finance, stock return volatility is measured as annualized standard deviation, and a one-SD daily move in the S&P 500 has historically been about 0.8–1.0%.
What Is a Good Standard Deviation?
There is no universal answer — what counts as a "good" standard deviation depends entirely on the context and scale of your data.
A standard deviation of 15 points is the built-in benchmark for IQ scores (mean 100, SD 15). A standard deviation of 15 dollars on a $5 coffee order would be extreme. A standard deviation of 15 years on human lifespan data is fairly typical.
The most useful question is not "is this SD good?" but "is this SD expected for this data?" Two benchmarks help:
- Coefficient of Variation (CV) = (SD / Mean) × 100 — expresses SD as a percentage of the mean, making comparison across different units possible. A CV under 15% is generally considered low variability; above 30% is high. For the grocery example: CV = (18.24 / 154.20) × 100 = 11.8% — reasonably consistent spending.
- Compare to similar datasets — if you know the typical SD for your field, compare directly. In educational testing, a class SD of 8–12 points on a 100-point exam is typical. A class SD of 2 points suggests the test was too easy; a SD of 25 points suggests extreme spread in preparation.
The standard deviation calculator displays both SD and the coefficient of variation alongside the result, so you can assess spread in context rather than as a raw number.
Common Mistakes to Avoid When Calculating Standard Deviation
-
Dividing by n instead of n − 1 for a sample. This produces population SD when you need sample SD. The results look similar but are technically wrong for inferential statistics. When in doubt, use n − 1 — it is the correct default for any sampled data.
-
Forgetting to square the deviations before summing them. Students sometimes add the raw deviations (xi − x̄) instead of the squared deviations. Raw deviations always sum to zero — positive and negative deviations cancel exactly. If your sum of deviations equals zero, you have added the unsquared values. Go back and square each one before summing.
-
Taking the square root too early. Standard deviation is the square root of the variance, not the square root of individual squared deviations. Calculate the full sum of squared deviations, divide by n − 1, and only then take the square root of the result.
-
Using the wrong mean when working with grouped or weighted data. If your data has frequencies (value 7 appears 4 times, value 9 appears 6 times), you must use the weighted mean, not the simple sum divided by count of unique values. Using the unweighted mean with frequency data produces a wrong standard deviation.
-
Assuming standard deviation applies the same way to non-normal distributions. The empirical rule (68-95-99.7) only holds for approximately normal distributions. For heavily skewed datasets — income data, website traffic, biological counts — the rule breaks down. Standard deviation still measures spread, but you cannot assume that "within 2 SD" means "95% of values." The statistics calculator shows skewness alongside SD to help you assess whether the empirical rule applies.
Frequently Asked Questions
What is standard deviation in simple terms? Standard deviation is a measure of how spread out the values in a dataset are around the mean. A small standard deviation means most values cluster close to the average; a large one means they are widely scattered. For example, two classes both average 75 on an exam — but if Class A has SD = 4 and Class B has SD = 18, Class B has far more varied performance, from students failing to students excelling.
What if all my values are the same — what is the standard deviation? If every value in your dataset is identical, the standard deviation is exactly zero. Every deviation from the mean is zero, every squared deviation is zero, and the square root of zero is zero. A standard deviation of zero is the lower bound — it is mathematically impossible to get a negative standard deviation. If your calculation produces a negative number, you have an arithmetic error before the square root step.
What is the difference between variance and standard deviation? Variance is the average of squared deviations from the mean. Standard deviation is the square root of variance. The key practical difference is units: if your data is in dollars, variance is in dollars-squared (which has no intuitive meaning), while standard deviation is back in dollars. Standard deviation is almost always the number you report because it exists in the same units as the original data and can be compared directly to the mean.
How many data points do I need for standard deviation to be reliable? Standard deviation becomes more reliable as sample size increases. With fewer than 10 data points, the standard deviation estimate has wide confidence intervals and may not represent the true population spread well. For reporting purposes, most statistical standards recommend at least 30 data points for a sample SD to be meaningful. Below that threshold, report the SD alongside the sample size so readers can assess the reliability themselves.
When should I use the standard deviation calculator vs calculating by hand? Calculate by hand when you are learning the formula, completing a homework problem, or working with 5–10 data points and need to show your work. Use the standard deviation calculator for any dataset larger than 10 values, when working with real data where an arithmetic error has consequences, or when you need additional statistics (mean, variance, coefficient of variation) alongside the SD. Manual calculation is valuable for understanding; automated calculation is valuable for accuracy at scale.
Use the Free Standard Deviation Calculator
The Free Standard Deviation Calculator at RoughTools calculates both population and sample standard deviation from any list of values — just paste your numbers separated by commas or line breaks. It shows the full step-by-step breakdown including the mean, each squared deviation, the sum of squares, and variance, so you can verify every step of the manual method above. Results include SD, variance, mean, and coefficient of variation. No account needed, no data stored, completely free.
Free Standard Deviation Calculator →
You might also need:
- Mean Median Mode Calculator — calculate the central tendency of your dataset alongside spread
- Z-Score Calculator — convert any value to standard deviations from the mean
- Confidence Interval Calculator — build a confidence interval using your sample SD
- Statistics Calculator — get a complete descriptive statistics summary including skewness and kurtosis