Standard Deviation Formula for Samples- Calculate with Confidence
What Standard Deviation Actually Is
Standard deviation measures how spread out numbers are from their average. That's it. A low standard deviation means numbers cluster close together. A high standard deviation means they're all over the place.
Most people encounter this when working with sample data—information collected from a subset of a larger group. This matters because the formula changes depending on whether you have all the data or just a portion of it.
Sample vs Population Standard Deviation
Population standard deviation uses every single data point you have. You divide by N (the total count).
Sample standard deviation uses a portion of data to estimate the whole. You divide by N-1 instead of N. This correction (called Bessel's correction) gives you a more accurate estimate when working with samples.
In almost every real-world scenario, you're working with samples. Customer surveys, medical studies, quality testing—all samples. So you need the sample standard deviation formula.
The Sample Standard Deviation Formula
Here's the formula:
s = √[ Σ(xi - x̄)² / (n-1) ]
- s = sample standard deviation
- xi = each individual data point
- x̄ = the sample mean (average)
- n = total number of data points
- Σ = sum of all values
The N-1 in the denominator is what makes this the sample formula. Use it whenever your data is a subset of the larger group you care about.
How to Calculate Sample Standard Deviation (Step by Step)
Let's use real numbers. Suppose you measured the height of 5 plants (in cm): 14, 17, 16, 18, 15
Step 1: Find the Mean
Add them up and divide: (14 + 17 + 16 + 18 + 15) / 5 = 16 cm
Step 2: Find the Deviations
Subtract the mean from each value:
- 14 - 16 = -2
- 17 - 16 = 1
- 16 - 16 = 0
- 18 - 16 = 2
- 15 - 16 = -1
Step 3: Square Each Deviation
- (-2)² = 4
- (1)² = 1
- (0)² = 0
- (2)² = 4
- (-1)² = 1
Step 4: Sum the Squared Deviations
4 + 1 + 0 + 4 + 1 = 10
Step 5: Divide by N-1
10 / (5-1) = 10 / 4 = 2.5
Step 6: Take the Square Root
√2.5 = 1.58 cm
The sample standard deviation is 1.58 cm. This tells you the typical distance each plant's height is from the average.
Sample Standard Deviation vs Population Standard Deviation
| Feature | Sample (s) | Population (σ) |
|---|---|---|
| Formula | √[Σ(xi-x̄)² / (n-1)] | √[Σ(xi-μ)² / N] |
| When to use | Working with a subset of data | You have every data point |
| Denominator | n - 1 (unbiased estimate) | N (exact calculation) |
| Common in | Research, surveys, quality control | Census data, full datasets |
The difference matters most with small samples. With 100+ data points, the difference between dividing by N and N-1 becomes negligible.
When to Use Each Formula
Ask yourself one question: Is this data the entire population or a sample of it?
Use sample standard deviation when:
- Surveying 500 people to estimate opinions of millions
- Testing 20 products from a manufacturing run of 10,000
- Measuring blood pressure of 100 patients to understand a disease
Use population standard deviation when:
- Calculating test scores for your entire class
- Analyzing data from a complete census
- Working with a finite, closed dataset with no larger group
If you're unsure, default to sample standard deviation. It's the safer choice for estimation.
Common Mistakes to Avoid
Using population formula on sample data. This underestimates variability. Your standard deviation will be artificially low.
Forgetting to square the deviations. Deviations sum to zero (that's how means work). Squaring makes everything positive.
Using N instead of N-1 for samples. Unless you specifically need population standard deviation, divide by N-1.
Rounding too early. Keep full precision through calculations. Round only at the end.
Quick Reference Table
| n value | Divide sum by | Effect on result |
|---|---|---|
| 5 | 4 | 25% larger than population formula |
| 10 | 9 | 11% larger |
| 30 | 29 | 3.4% larger |
| 100 | 99 | 1% larger |
Calculators and Software
You don't need to do this by hand every time. These tools handle it:
- Excel/Google Sheets:
=STDEV.S(range)for samples,=STDEV.P(range)for populations - Python:
statistics.stdev(data)(sample) orpstatistics.pstdev(data)(population) - Online calculators: Search for "sample standard deviation calculator" for quick results
The manual calculation still matters. Understanding the steps helps you catch errors and interpret results correctly.
The Bottom Line
Sample standard deviation is s = √[ Σ(xi - x̄)² / (n-1) ]. Use it whenever your data represents a subset of a larger group. The N-1 correction gives you an unbiased estimate of the true variability.
Calculate the mean, find each deviation from that mean, square those deviations, sum them up, divide by N-1, and take the square root. That's the entire process.