In statistics, when you measure a sample, the results are only an estimate of the true population. For example, if you survey 100 people and find they sleep 7 hours a night, that doesn't mean the entire city averages exactly 7 hours. A confidence interval calculates a range of values (like 6.8 to 7.2 hours) that is highly likely to contain the true average of the whole population.
To calculate the interval, you need the sample mean, the standard deviation, and the sample size. The formula is: Mean ± Margin of Error. The margin of error is calculated by multiplying a critical value (derived from your selected confidence level) by the standard error (standard deviation divided by the square root of the sample size).
Critical values are based on normal distribution scores, which you can check using our standard z-score values tool. To find the correct number of survey responses before calculating intervals, check out our estimating survey respondents tool. For a broader look at data, view our comprehensive statistics summaries tool.
The confidence level (typically 90%, 95%, or 99%) represents how sure you want to be that your range contains the true population average. A 95% confidence level means that if you repeated the survey 100 times, 95 of those generated ranges would contain the true average.
As you increase the confidence level, the margin of error grows, making the range wider. This represents the statistical tradeoff: to be more certain, you must accept a wider, less precise estimation range.
Suppose a store surveys 64 customers and finds they spend an average of $50 per visit, with a standard deviation of $16. They select a 95% confidence level (critical Z-value of 1.96).
The standard error is 16 / square_root(64) = 16 / 8 = 2. The margin of error is 1.96 × 2 = 3.92. Subtracting and adding this to the mean: $50 - $3.92 = $46.08, and $50 + $3.92 = $53.92. The confidence interval is $46.08 to $53.92. The store is 95% confident that the true average spend of all customers is between these two amounts.