What Is n in Confidence Interval? Sample Size Explained
The calculator for this page is switched off while it is checked. The formula is below, and the worked example in the article shows how to use it by hand.
This page explains the role of n in a confidence interval: it is the sample size, the number of observations or measurements in your data set. You enter your sample size, sample mean, and standard deviation (or standard error) into the calculator, and it returns the margin of error and the confidence interval bounds. The value of n directly determines the width of the interval—larger samples produce narrower, more precise intervals.
Formula
The confidence interval for a population mean (when the population standard deviation is known or the sample is large) is:
CI = x̄ ± z* × (σ / √n)
- x̄ (x-bar) = sample mean (the average of your data)
- z* = critical value from the standard normal distribution (e.g., 1.96 for 95% confidence)
- σ = population standard deviation (or sample standard deviation s when estimating)
- n = sample size (the number of observations)
The term σ / √n is the standard error of the mean. It measures how much the sample mean is expected to vary from the true population mean. The square root of n is in the denominator, so as n increases, the standard error decreases, making the interval narrower.
Worked Example
Using the default values from the calculator above: n = 30, sample mean = 100, sample standard deviation = 15, confidence level = 95%.
- Find the critical value z* for 95% confidence: z* = 1.96.
- Calculate the standard error: SE = 15 / √30 = 15 / 5.477 = 2.7386.
- Compute the margin of error: ME = 1.96 × 2.7386 = 5.3677.
- Lower bound = 100 − 5.3677 = 94.63.
- Upper bound = 100 + 5.3677 = 105.37.
The 95% confidence interval is (94.63, 105.37). The calculator rounds to two decimal places, giving the same result.
Why n Matters
The sample size n is the number of independent observations in your sample. It is not the population size (usually denoted N). For example, if you survey 200 customers out of 10,000, then n = 200 and N = 10,000.
Larger n gives:
- Narrower confidence intervals (more precision)
- Greater statistical power to detect true effects
- More stable estimates of the population parameter
However, the relationship is not linear: to halve the margin of error, you need to quadruple the sample size (since √n is in the denominator).
How to Choose n
Before collecting data, you often need to decide how large a sample to take. The required n depends on:
- Desired confidence level (e.g., 90%, 95%, 99%)
- Acceptable margin of error (E)
- Estimated variability in the population (σ or s)
The formula for the required sample size (for a mean) is:
n = (z* × σ / E)²
For example, to estimate a population mean with 95% confidence, a margin of error of ±3, and an estimated standard deviation of 15:
n = (1.96 × 15 / 3)² = (9.8)² = 96.04, so you would round up to 97.
Common Mistakes and Misconceptions
Mistake 1: Using n = 1 or a very small sample. With n = 1, the standard error is just the standard deviation, and the interval is extremely wide. Also, the normal approximation (z*) is only valid for large n (typically n ≥ 30) or when the population is normally distributed and σ is known. For small samples, use the t-distribution instead.
Mistake 2: Confusing n with N. n is always the sample size, not the population size. The population size only matters when sampling without replacement from a finite population, where a finite population correction may be applied.
Mistake 3: Ignoring the square root. Some people mistakenly divide σ by n instead of √n, which gives a much smaller standard error and an overly narrow interval.
Mistake 4: Rounding too early. Rounding intermediate values like the standard error can change the final interval. Keep extra decimal places until the end.
When the t-Distribution Is Needed
When n is small (usually n < 30) and the population standard deviation σ is unknown (you only have the sample standard deviation s), the confidence interval should use the t-distribution instead of the normal distribution. The formula becomes:
CI = x̄ ± t* × (s / √n)
where t* is the critical value from the t-distribution with n − 1 degrees of freedom. For example, with n = 10 and 95% confidence, t* = 2.262 (from the t-table), which is larger than 1.96, producing a wider interval to account for the extra uncertainty.
Most statistical software automatically uses the t-distribution when σ is unknown, regardless of sample size, because it is more conservative and accurate.
Limits of the Formula
The standard confidence interval formula assumes:
- Random sampling from the population
- Independent observations
- Approximately normal distribution (or large n due to the Central Limit Theorem)
If the sample is not random, the interval may be biased. If the data are heavily skewed and n is small, the normal approximation may be poor. In such cases, nonparametric methods or bootstrapping can be used.
Also, the confidence level (e.g., 95%) means that if you repeated the sampling process many times, about 95% of the intervals would contain the true population mean. It does not mean there is a 95% chance that the true mean lies within a particular interval.
Frequently Asked Questions
Q: What does n stand for in a confidence interval?
n stands for the sample size—the number of observations in your data set. It appears in the denominator of the standard error formula (√n), controlling the precision of the interval.
Q: How does increasing n affect the confidence interval?
Increasing n decreases the standard error, which narrows the margin of error and the interval width. For example, quadrupling n cuts the margin of error in half.
Q: What is the minimum sample size for a confidence interval?
There is no absolute minimum, but for the normal approximation to be valid, n ≥ 30 is a common rule of thumb. For smaller samples, use the t-distribution.
Q: What is the difference between n and N?
n is the sample size (the number you actually measure), while N is the total population size. For example, if you survey 100 people out of 10,000, n = 100 and N = 10,000.
Q: Can n be a decimal?
No, n must be a whole number because you cannot have a fraction of an observation. When calculating required sample size, always round up to the next integer.
Q: Why is the square root of n used?
The square root comes from the standard deviation of the sampling distribution of the mean. The variance of the sample mean is σ²/n, so the standard deviation is σ/√n. This is a fundamental result of probability theory.
Related
Formula used
in n | Sample size (n) | - | 30 | 1 in mean | Sample mean | - | 100 | 0 in sd | Sample standard deviation | - | 15 | 0 in cl | Confidence level | % | 95 | 0 out moe | Margin of error | - | (1.96 * sd / sqrt(n)) | 2 out lower | Lower bound | - | mean - (1.96 * sd / sqrt(n)) | 2 out upper | Upper bound | - | mean + (1.96 * sd / sqrt(n)) | 2
Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.