Maths

Confidence Interval Calculator

Find the confidence interval for a mean or a proportion, with the margin of error.

By Nitin Raturi · Last reviewed

Your sample

How to use the Confidence Interval Calculator

Find the range likely to contain a population mean or proportion.

  1. Choose mean or proportion.
  2. Enter your sample results and sample size.
  3. Choose a confidence level.
  4. Read the interval, the margin of error and the standard error.

Good to know

  • A bigger sample gives a narrower interval.
  • The interval is about the method, not a probability for one interval.
Estimate

Estimate

Whether you are estimating an average (mean) or a share (proportion).

How to fill it in

  • Mean: average height, score or time.
  • Proportion: the share who said yes.

Sample mean

The average of your sample.

How to fill it in

  • Enter any number.

Example

A mean of 68 with σ = 3 and n = 36 gives a 90% interval of 67.18 to 68.82.

Population standard deviation (σ)

How spread out the values are in the whole population.

How to fill it in

  • Enter a value above 0.

Keep in mind: This interval assumes σ is known. If you only have the sample’s standard deviation and fewer than about 30 values, a t-interval is wider.

Sample size

How many people or items are in the sample.

How to fill it in

  • Enter a whole number.

Confidence level

How often intervals made this way would contain the true value.

How to fill it in

  • Enter 50% to 99.99%. 90%, 95% and 99% are common.

Example

The mean example’s margin is ±0.82 at 90%, ±0.98 at 95% and ±1.29 at 99%.

90% confidence interval

67.1776 to 68.8224

Estimate 68.0000 ± 0.8224 (z = 1.645, standard error 0.5000).

Normal (z) interval with known σ: x̄ ± z·σ ÷ √n.

How this calculator works

  1. Step 1Estimatex̄ or p̂Your sample’s mean or share.
  2. Step 2Standard errorσ ÷ √nHow much the estimate varies from sample to sample.
  3. Step 3Margin± z × SEz sets how sure you want to be.

A confidence interval is your estimate plus and minus a margin of error. A 90% level means intervals made this way contain the true value 90% of the time.

Worked example: the textbook mean

OpenStax Example 8.2: x̄ = 68, σ = 3, n = 36, 90%
Interval
x̄ ± z × σ ÷ √n
  1. Standard error3 ÷ √360.50
  2. z for 90%1.645
  3. Marginz × 0.5±0.82
  4. Interval67.18 to 68.82

The textbook gives (67.18, 68.82), the same to two decimals.

A proportion

  • Normal interval81.0% – 87.4%The textbook method: p̂ ± z × √(p̂(1 − p̂) ÷ n).
  • Wilson interval80.7% – 87.1%Better behaved for small samples and extreme shares.

More confidence, wider interval

  • 90%±0.82
  • 95%±0.98
  • 99%±1.29
Margin of error for the mean example

To halve the margin at the same confidence, you need four times the sample.

Assumptions and limits

  • Random sampleEach member picked independently.
  • Known σMean mode uses z, not t.
  • Large enoughWarnings appear for small samples.
  • Not one interval’s chanceThe level describes the method.

An interval shows how precise an estimate is. Planning a study and testing a result are the steps around it.

To plan how many responses you need, use the sample size calculator. For the spread of raw data, try the standard deviation calculator, and to compare two means, the t-test calculator.

Common mistakes

  • Mistake: Using z with a small sample and its own s.

    Instead: Use a t-interval, which is wider.

  • Mistake: Saying the true value is 90% likely inside.

    Instead: Say 90% of such intervals capture it.

  • Mistake: Ignoring a biased sample.

    Instead: No interval fixes a poor sampling method.

Checking the method

A separate script re-works every golden value with Python's inverse normal and a quadratic solve, and reproduces both OpenStax examples.

Read how we test our calculators, or browse more maths calculators.

Frequently asked questions

How do I find a confidence interval for a mean?

x̄ ± z × σ ÷ √n. A mean of 68, σ 3, n 36 at 90% gives 67.18 to 68.82.

How do I find one for a proportion?

p̂ ± z × √(p̂(1 − p̂) ÷ n). 421 of 500 at 95% gives 81.0% to 87.4%.

What z do I use for 95%?

1.960, the value with 2.5% of the normal curve above it.

What does 95% confidence mean?

Intervals built this way contain the true value 95% of the time.

When should I use a t-interval?

When σ is unknown and the sample is small; the t-interval is wider.

Sources and methodology

The formulas are standard time-value-of-money results. We check every figure against golden values worked out independently, by closed form and by month-by-month simulation; see the methodology.

Written and maintained by Nitin Raturi, a software engineer (about the author). Last reviewed 4 Nov 2026; next review due by . Found an error? Tell us.

Changelog

  • : Initial release.