← Back to Blog

Confidence Interval Calculator: Margin of Error and Sample Size

Calculate confidence intervals for a population mean or proportion. Find the margin of error, determine required sample size, and interpret what a 95% CI actually means.

Confidence Interval Calculator: Margin of Error and Sample Size

Confidence Intervals

A confidence interval gives a range within which the true population parameter likely falls. A 95% CI means: if you repeated the sampling 100 times, ~95 of those intervals would contain the true value.

CI for Population Mean (large n or known σ)

CI = x̄ ± z*(σ/√n)
z* = 1.645 (90%) | 1.960 (95%) | 2.576 (99%)

Example: n=100, x̄=50, σ=8, 95% CI:
ME = 1.96 × 8/√100 = 1.96 × 0.8 = 1.568
CI = (48.43, 51.57)

CI for Proportion

p̂ ± z* × √(p̂(1-p̂)/n)
Survey: n=400, 230 yes (p̂=0.575), 95% CI:
SE = √(0.575×0.425/400) = 0.02473
ME = 1.96 × 0.02473 = 0.0485
CI = (52.65%, 62.35%)

Required Sample Size

n = (z* × σ/ME)²   (for mean)
n = z*² × p̂(1-p̂)/ME²  (for proportion)

95% CI, ME=±3%, p̂=0.5 (worst case):
n = 1.96² × 0.25/0.03² = 3.84×0.25/0.0009 = 1067

Calculate confidence intervals: Free Confidence Interval Calculator