A worked example: mean 100, std dev 15, n=36, 95% confidence
A sample with a mean of 100, a standard deviation of 15, and 36 observations gives a margin of error of 4.9 at 95% confidence — a confidence interval running from 95.1 to 104.9.
The formula: Z × (standard deviation ÷ √sample size)
The margin of error scales with the sample's variability (a noisier sample needs a wider margin) and shrinks with the square root of the sample size — more data narrows the estimate, but with diminishing returns, since quadrupling the sample size is needed to halve the margin, not just doubling it.
How the confidence level changes the interval: 99% instead of 95%
The same mean of 100, standard deviation of 15, and 36 observations gives a wider margin of 6.44 at 99% confidence — a wider interval from 93.56 to 106.44. Demanding more confidence that the true mean falls inside the interval requires casting a wider net.
What "95% confidence" actually means
It's a statement about the method, not this one specific interval: if the same sampling process were repeated many times, about 95% of the resulting intervals would contain the true population mean. It isn't a 95% probability that this particular interval happens to contain it.
When this Z-based approach isn't quite right
This uses the normal (Z) distribution, a reasonable approximation once the sample size is around 30 or more. Smaller samples technically need the t-distribution instead, which has fatter tails to account for the extra uncertainty of estimating variability from less data.