Math Tools

Confidence Interval Calculator for a Mean

Calculate a confidence interval for a population mean from a sample: enter the sample mean, the standard deviation and the sample size, and choose the confidence level. The calculator uses the t distribution by default and shows the margin of error and the critical value.

01

Your inputs

Start with the example, or enter your own values.

Processed in your browser. Your inputs stay on this device.

02

Your result

A little clarity, coming right up.

Make room for the answer.

Enter your values and run the tool. Your result will appear here.

How to use the Confidence Interval Calculator

Enter the mean, standard deviation and sample size, choose the confidence level and t or z, then press Calculate.

Read more: How to Use the Confidence Interval Calculator: Steps and a Worked Example

The confidence interval formula

Interval = mean ± critical value × SD ÷ √n. With a mean of 50, SD 8 and n = 40 at 95%, the standard error is 8 ÷ √40 = 1.265, the t critical value with 39 degrees of freedom is 2.023, and the interval is 50 ± 2.56, from 47.44 to 52.56.

t or z?

Use t when the standard deviation comes from your sample, which is almost always. Use z only when the population standard deviation is known. For large samples the two are nearly the same: the 95% z value is 1.960.

What 95% confidence means

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 that this particular interval contains it.

The formula

Interval = mean ± critical value × SD ÷ √n. The t critical value uses n − 1 degrees of freedom.

Examples

  • With the default values
    Interval: 47.4415 to 52.5585
    Margin of error: ± 2.5585
    Critical value (t, 39 df): 2.0227
    Standard error: 1.2649
  • With sample mean set to 100
    Interval: 97.4415 to 102.5585
    Margin of error: ± 2.5585
    Critical value (t, 39 df): 2.0227
    Standard error: 1.2649

Limitations and assumptions

Assumes a random sample and a roughly normal sampling distribution (fine for n of about 30 or more).

Frequently asked questions

What is the z value for 95%?

1.960. For 90% it is 1.645 and for 99% it is 2.576.

How do I make the interval narrower?

Use a larger sample: quadrupling n halves the margin of error.

What is the margin of error?

Half the width of the interval: the critical value times the standard error.