Skip to content
FiftyCalc Free calculators for all 50 states

Confidence Interval Calculator

Test cases replayed : 4 of 4 match · Methodology · No outside source listed

Enter the sample mean, standard deviation and size, and pick a confidence level, to get the interval and its margin of error.

Result

Sample figures

Lower bound—

Upper bound —

  • Critical value (t* or z*)—
  • Standard error (s ÷ √n)—
  • Margin of error—

Estimate for planning only, not tax, legal, financial or medical advice. This calculator uses the method explained on this page.

Confidence Interval Calculator

Sample mean (x̄): enter a number. Prefilled example: 50.

Standard deviation (s, or σ if known): enter 0 or more. Prefilled example: 8.

Sample size (n): enter 2 or more. Prefilled example: 25.

Confidence level: choose one of the 6 options in the list. Prefilled example: 95%.

Method: choose t interval (standard deviation from the sample) or z interval (population σ known). Prefilled example: t interval (standard deviation from the sample).

How to use this calculator

Fill in the fields in this order; each step takes you to its field.

  1. Sample mean (x̄): enter a number.
  2. Standard deviation (s, or σ if known): enter 0 or more.
  3. Sample size (n): enter 2 or more.
  4. Confidence level: choose one of the 6 options in the list.
  5. Method: choose t interval (standard deviation from the sample) or z interval (population σ known).
  6. Read the result: Lower bound; the panel also shows Critical value (t* or z*), Standard error (s ÷ √n), Margin of error and Upper bound.

How this calculator works

Interval = x̄ ± critical value × s ÷ √n. With the standard deviation from the sample, the critical value is t* from Student's t distribution with n − 1 degrees of freedom; when the population σ is known, it is z* from the standard normal distribution.

z* and t* are found by inverting the normal and Student's t distribution functions numerically (bisection). Results are rounded to 3 decimals.

Common z* values: 1.645 for 90%, 1.960 for 95%, 2.576 for 99%.

The formula

  1. Se=sdn
  2. Lo=round⁡(x̄−{tinv⁡(1−1−c2,n−1)if m=1−norminv⁡(1−c2)otherwise×Se,3)
Symbols used in the formula
SymbolMeaning
x̄Sample mean
sdStandard deviation (s, or σ if known)
nSample size
cConfidence level
mMethod (1: t interval (standard deviation from the sample); 2: z interval (population σ known))
SeStandard error (s ÷ √n)
LoLower bound
round(x, d)x rounded to d decimal places, or to a whole number without d.
tinv(p, d)the value that a Student's t variable with d degrees of freedom stays at or below with probability p.
norminv(p, m, s)the value that a Gaussian variable with mean m and standard deviation s stays at or below with probability p (mean zero and standard deviation one without m and s).

Worked example

Sample mean (x̄)50
Standard deviation (s, or σ if known)8
Sample size (n)25
Confidence level95%
Methodt interval (standard deviation from the sample)
Critical value (t* or z*)2.064
Standard error (s ÷ √n)1.6
Margin of error3.302
Upper bound53.302
  1. Se=825=1.6
  2. Lo=round⁡(50−tinv⁡(1−1−0.952,25−1)×1.6,3)=46.698

Lower bound 46.698

Each step uses the unrounded value of the step before it; figures on this page are rounded for display.

Frequently asked questions

What is the 95% confidence interval for a mean of 50, SD 8 and n = 25?

t* = 2.064 with 24 degrees of freedom, the standard error is 8 ÷ 5 = 1.6, so the interval is 46.698 to 53.302.

What does a 95% confidence interval mean?

If you repeated the sampling many times, about 95% of the intervals built this way would contain the true mean. It is not a 95% chance for this one interval.

Why is the 99% interval wider than the 95% one?

More confidence needs a larger critical value (2.576 instead of 1.960 for z), which widens the margin of error.

Questions answered

Related calculators