Skip to content
CalculatorAtlas

Confidence Interval Calculator

Tested

Confidence interval for a mean (t or z).

Tested, not yet published. The formula for this calculator is implemented and passes its automated checks. This page stays non-indexable until it is reviewed and published.

%

Results

Enter your values and press Calculate. Results appear here.

  • • Result

Quick answer

A confidence interval for a mean is x̄ ± c × s ÷ √n, using the t critical value when σ is unknown. A sample mean of 50 with s = 10 and n = 25 at 95% gives 45.87 to 54.13, a margin of 4.128 (t = 2.0639).

Enter the sample mean, standard deviation, sample size, confidence level and method. The calculator returns the interval, margin of error and critical value.

Related tools: Sample Size Calculator: Sample size for estimating a mean or a proportion. Z-Score Calculator: Standardize a value using a mean and standard deviation. Standard Deviation Calculator: Sample or population standard deviation with variance and mean.

How to use the Confidence Interval Calculator

  1. Enter sample mean.
  2. Enter standard deviation (s, or σ for z) (above 0).
  3. Enter sample size (a whole number, 2 or more).
  4. Enter confidence level (%) (between 0 and 99.999). It starts at 95.
  5. Choose method: t (σ unknown) and z (σ known).
  6. Press Calculate to see the result, and use Reset to start again.
Inputs of the Confidence Interval Calculator
InputWhat to enterAllowed values
Sample meanA number—
Standard deviation (s, or σ for z)A number> 0
Sample sizeA whole number≥ 2
Confidence levelA number, in %> 0, ≤ 99.999, starts at 95
MethodChoose one: t (σ unknown); z (σ known)Starts at t (σ unknown)

Formula and method

Formula

x̄ ± c × s ÷ √n, with c = t*(n−1) or z*

IEEE-754 double precision; shown to at most 6 decimal places.

Critical values by inversion of the exact t or normal CDF.

Worked examples

These examples are verified: each one is an automated test case that the live calculator must reproduce exactly.

Example 1

Inputs: Sample mean = 50; Standard deviation (s, or σ for z) = 10; Sample size = 25; Confidence level = 95; Method = t (σ unknown).

Results of example 1
ResultValue
Confidence interval45.872203 to 54.127797
Margin of error4.127797
Critical value2.063899

Example 2

Inputs: Sample mean = 50; Standard deviation (s, or σ for z) = 10; Sample size = 100; Confidence level = 95; Method = z (σ known).

Results of example 2
ResultValue
Confidence interval48.040036 to 51.959964
Margin of error1.959964
Critical value1.959964

The first line is the headline result (confidence interval). Below it the confidence Interval Calculator lists margin of error and critical value, which describe the same case from other angles. IEEE-754 double precision; shown to at most 6 decimal places.

Reading it

If you repeated the sampling many times, about 95% of such intervals would contain the true mean. The standard error is 10 ÷ 5 = 2, and 2.0639 × 2 = 4.128.

t or z

The t method (24 degrees of freedom) is used when σ is estimated from the sample; z is for a known σ or very large n, where the critical value is 1.96. Bigger samples and lower confidence give narrower intervals. n must be at least 2.

How the result changes with sample mean

Holding every other input at the first worked example, this table changes only sample mean. It shows how sensitive the answer is to that one value; each row was produced by running this calculator.

How the result changes with sample mean
Sample meanConfidence intervalMargin of errorCritical value
2520.872203 to 29.1277974.1277972.063899
5045.872203 to 54.1277974.1277972.063899
10095.872203 to 104.1277974.1277972.063899
200195.872203 to 204.1277974.1277972.063899

What happens with invalid input

These messages are produced by the calculator itself, so you know what to fix.

  • Sample size: entering "1" shows "Sample size must be at least 2." beside that field and no result.

Choosing between the Confidence Interval Calculator and similar calculators

Each row shows what a related calculator on this site asks for and what it returns, so you can pick the one that matches your question.

Choosing between the Confidence Interval Calculator and similar calculators
CalculatorYou enterIt returns
[Sample Size Calculator](/statistics/sample-size-calculator/)estimate a, confidence level and margin of errorRequired sample size
[Z-Score Calculator](/statistics/z-score-calculator/)value, mean and standard deviationZ-score
[Standard Deviation Calculator](/statistics/standard-deviation-calculator/)data set and data typePopulation standard deviation (σ)
[Mean Median Mode Calculator](/statistics/mean-median-mode-calculator/)data setMean
[Point Estimate Calculator](/statistics/point-estimate/)successes and trialsSample proportion

Background: hypothesis testing and inference

A hypothesis test compares a test statistic with what the null hypothesis predicts. The decision rule is to reject the null hypothesis when the p-value is at or below the significance level α, which you should choose before seeing the data (0.05 is conventional, not special). For a two-tailed z test the p-value is 2 × (1 − Φ(|z|)); for a one-sample t test the statistic is (x̄ − μ₀) ÷ (s ÷ √n) with n − 1 degrees of freedom.

Failing to reject the null hypothesis does not prove it true, and a statistically significant result can still be too small to matter in practice.

Assumptions and limitations

  • n ≥ 2

If a required value is empty, not a number, or outside its allowed range, the form marks that field with a message and shows no result instead of a misleading number. The automated checks deliberately try invalid entries for sample size to confirm this.

Frequently asked questions

What does 95% confidence mean?

The method captures the true mean 95% of the time.

How do I narrow the interval?

Increase the sample size.

Why use t?

It accounts for estimating σ.

What does the Confidence Interval Calculator calculate?

Confidence interval for a mean (t or z). It returns Confidence interval, Margin of error and Critical value.

What formula does the Confidence Interval Calculator use?

x̄ ± c × s ÷ √n, with c = t*(n−1) or z*. Critical values by inversion of the exact t or normal CDF.

What do I need to enter in the confidence Interval Calculator?

You enter Sample mean, Standard deviation (s, or σ for z), Sample size, Confidence level (%) and Method.

How is the result rounded or limited?

IEEE-754 double precision; shown to at most 6 decimal places. n ≥ 2.

What does the “Method” option change?

It sets how the confidence Interval is worked out. The choices are t (σ unknown) and z (σ known).

What is an example of a confidence Interval result?

With sample mean 50, standard deviation (s, or σ for z) 10, sample size 25, confidence level 95 and method t (σ unknown), the confidence interval is 45.872203 to 54.127797.

Sources

  • NIST/SEMATECH e-Handbook of Statistical Methods (itl.nist.gov/div898/handbook)
  • Standard textbook definitions (e.g. Moore, McCabe & Craig, Introduction to the Practice of Statistics)

Content last reviewed 2026-11-04. Formulas and worked examples are checked by automated tests against independently computed values.