Percentages & Everyday Math
Statistics Calculator
Standard deviation, variance, mean, median, mode, quartiles, z-scores, and confidence intervals.
Result
Enter your numbers and press Calculate to see the result.
Calculating…
Standard deviation, step by step
Standard deviation measures how far values sit from the mean on average. It is the square root of the variance, and the variance is the mean of the squared distances:
| Step | What you do |
|---|---|
| 1 | Find the mean |
| 2 | Subtract the mean from each value |
| 3 | Square each difference |
| 4 | Add the squares together |
| 5 | Divide by n − 1 for a sample, or n for a population |
| 6 | Take the square root |
s = √( Σ(x − x̄)² ÷ (n − 1) ) · σ = √( Σ(x − μ)² ÷ n )
Squaring in step 3 is doing real work: it removes the sign so distances above and below the mean do not cancel, and it weights large deviations far more heavily than small ones. That is why a single outlier moves the standard deviation so much.
Sample or population — the n − 1 question
Dividing by n − 1 instead of n is Bessel's correction, and it exists because a sample's own mean is always closer to the sample than the true population mean is. Without the correction, sample variance systematically underestimates the population variance.
| Use | Divisor | When |
|---|---|---|
| Sample (s) | n − 1 | Your data is a subset you are generalising from — the usual case |
| Population (σ) | n | You have every member of the group, e.g. all 30 students in one class |
The gap matters at small n and vanishes at large n. With 5 values the two differ by about 12%; with 500 the difference is under 0.1%. When in doubt, use the sample formula — it is the conservative choice and what statistical software defaults to.
Worked example
For the values 12, 15, 15, 18, 21, 24, 27, 30 — mean 20.25:
| Value | x − x̄ | (x − x̄)² |
|---|---|---|
| 12 | −8.25 | 68.06 |
| 15 | −5.25 | 27.56 |
| 15 | −5.25 | 27.56 |
| 18 | −2.25 | 5.06 |
| 21 | 0.75 | 0.56 |
| 24 | 3.75 | 14.06 |
| 27 | 6.75 | 45.56 |
| 30 | 9.75 | 95.06 |
| Sum of squares | 283.50 | |
Sample variance is 283.50 ÷ 7 = 40.50, so s = 6.36. Population variance would be 283.50 ÷ 8 = 35.44, giving σ = 5.95.
Mean, median, and mode
| Measure | What it is | Best when |
|---|---|---|
| Mean | Sum ÷ count | Data is roughly symmetric with no extreme values |
| Median | The middle value once sorted | Data is skewed or has outliers |
| Mode | The most frequent value | Categorical data, or finding the most common case |
The classic illustration is income. One billionaire in a room of a hundred people moves the mean enormously and the median not at all — which is exactly why income statistics are reported as medians.
A dataset can have no mode, one mode, or several. If every value appears once there is no mode, and reporting one anyway is a common mistake in coursework.
Z-scores
z = (x − mean) ÷ standard deviation
A z-score says how many standard deviations a value sits from the mean, which makes values from different scales directly comparable. A z of +2 means two standard deviations above the mean, whatever the units were.
| Z-score | Percentile | Meaning |
|---|---|---|
| −2.0 | 2.3% | Well below average |
| −1.0 | 15.9% | Below average |
| 0 | 50% | Exactly average |
| +1.0 | 84.1% | Above average |
| +1.96 | 97.5% | The 95% two-sided cutoff |
| +2.0 | 97.7% | Well above average |
In a normal distribution the 68–95–99.7 rule holds: roughly 68% of values fall within one standard deviation of the mean, 95% within two, and 99.7% within three. This only applies to normally distributed data — for a skewed dataset the proportions can be quite different.
Confidence intervals
CI = mean ± z × (standard deviation ÷ √n)
The term after the ± is the margin of error, built from the standard error — the standard deviation divided by the square root of the sample size.
| Confidence level | z value |
|---|---|
| 80% | 1.282 |
| 90% | 1.645 |
| 95% | 1.960 |
| 98% | 2.326 |
| 99% | 2.576 |
Because n is under a square root, quadrupling the sample only halves the margin of error. That is why polls tend to stop around 1,000 respondents — the next improvement costs four times as much.
A 95% interval does not mean "95% probability the true mean is in this range". It means that if you repeated the sampling many times, 95% of the intervals produced would contain the true mean. The distinction is pedantic in conversation and important in a statistics exam.
In Excel and Google Sheets
| Goal | Formula |
|---|---|
| Sample standard deviation | =STDEV.S(A1:A20) |
| Population standard deviation | =STDEV.P(A1:A20) |
| Sample variance | =VAR.S(A1:A20) |
| Mean / median / mode | =AVERAGE(), =MEDIAN(), =MODE.SNGL() |
| Quartiles | =QUARTILE.INC(A1:A20, 1) |
| Z-score | =STANDARDIZE(x, mean, sd) |
| Margin of error | =CONFIDENCE.NORM(0.05, sd, n) |
The older =STDEV() and =STDEVP() still work but are ambiguous about which basis they use.
Prefer the explicit .S and .P forms.
For a plain mean, median, and range without the dispersion measures, the average calculator is quicker. To express a difference between two figures as a percentage, use the percentage change calculator.
Statistics Calculator — frequently asked questions
Should I divide by n or n-1?
Use n-1 when your data is a sample you are generalising from, which is the usual case. Use n only when you have every member of the group. The correction exists because a sample mean sits closer to its own data than the true population mean does.
How do I calculate standard deviation by hand?
Find the mean, subtract it from each value, square the differences, add them up, divide by n-1 for a sample, then take the square root.
What is the difference between variance and standard deviation?
Standard deviation is the square root of the variance. Variance is in squared units, which makes it hard to interpret; taking the root puts the figure back into the same units as your data.
What does a z-score of 2 mean?
The value sits two standard deviations above the mean, which puts it around the 97.7th percentile in a normal distribution. Z-scores let you compare values measured on completely different scales.
What is the formula for a confidence interval?
Mean plus or minus z times the standard error, where the standard error is the standard deviation divided by the square root of n. For 95% confidence, z is 1.96.
Which Excel function should I use for standard deviation?
STDEV.S for a sample and STDEV.P for a population. The older STDEV and STDEVP still work but are ambiguous about which basis they use.