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
- Enter sample mean.
- Enter standard deviation (s, or σ for z) (above 0).
- Enter sample size (a whole number, 2 or more).
- Enter confidence level (%) (between 0 and 99.999). It starts at 95.
- Choose method: t (σ unknown) and z (σ known).
- Press Calculate to see the result, and use Reset to start again.
| Input | What to enter | Allowed values |
|---|---|---|
| Sample mean | A number | — |
| Standard deviation (s, or σ for z) | A number | > 0 |
| Sample size | A whole number | ≥ 2 |
| Confidence level | A number, in % | > 0, ≤ 99.999, starts at 95 |
| Method | Choose 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).
| Result | Value |
|---|---|
| Confidence interval | 45.872203 to 54.127797 |
| Margin of error | 4.127797 |
| Critical value | 2.063899 |
Example 2
Inputs: Sample mean = 50; Standard deviation (s, or σ for z) = 10; Sample size = 100; Confidence level = 95; Method = z (σ known).
| Result | Value |
|---|---|
| Confidence interval | 48.040036 to 51.959964 |
| Margin of error | 1.959964 |
| Critical value | 1.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.
| Sample mean | Confidence interval | Margin of error | Critical value |
|---|---|---|---|
| 25 | 20.872203 to 29.127797 | 4.127797 | 2.063899 |
| 50 | 45.872203 to 54.127797 | 4.127797 | 2.063899 |
| 100 | 95.872203 to 104.127797 | 4.127797 | 2.063899 |
| 200 | 195.872203 to 204.127797 | 4.127797 | 2.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.
| Calculator | You enter | It returns |
|---|---|---|
| [Sample Size Calculator](/statistics/sample-size-calculator/) | estimate a, confidence level and margin of error | Required sample size |
| [Z-Score Calculator](/statistics/z-score-calculator/) | value, mean and standard deviation | Z-score |
| [Standard Deviation Calculator](/statistics/standard-deviation-calculator/) | data set and data type | Population standard deviation (σ) |
| [Mean Median Mode Calculator](/statistics/mean-median-mode-calculator/) | data set | Mean |
| [Point Estimate Calculator](/statistics/point-estimate/) | successes and trials | Sample 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.
Related calculators
- 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.
- Mean Median Mode Calculator — Mean, median and mode of a data set.
- Point Estimate Calculator — Point estimates of a proportion (MLE, Laplace and Wilson).
- Standard Error Calculator — Standard error of a mean or a proportion.
- Margin of Error Calculator — Margin of error for a mean or a proportion.
- Odds Ratio Calculator — Odds ratio from a 2×2 table.
- Effect Size (Cohen's d) Calculator — Cohen's d for two groups.
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.