The Confidence Interval Calculator builds an interval around your sample mean. Enter your sample data and confidence level to get the range.
Confidence Interval Calculator
Get the whole interval — both bounds, the margin of error and the critical value — for z (σ known) or t (σ estimated), in one run.
Enter your values
Fill in the fields below — the result appears with every step shown.
Your result will appear here
Enter your values above, then press Calculate — or press Enter in any field.TinyExe · Confidence Interval Result
Calculated locally in your browser
—
Name
—
Method (z = sigma known, t = sigma unknown)
—
Sample mean (x̄)
—
Standard deviation (s, or σ in z mode)
—
How this was calculated
What to do next
TinyExe PDF & PNG exports carry the TinyExe logo and tinyexe.com header & footer.
Runs 100% in your browser — your numbers never leave this tab; nothing is uploaded or stored.
The short answer
A confidence interval for a mean is x̄ plus or minus a critical value times the standard error s over root n. Use the t critical value with n minus one degrees of freedom when sigma is estimated from the sample, and z only when sigma is genuinely known beforehand.
- CI = x̄ ± critical value × s/√n; the bounds are the headline output
- t* at df 10, 95% = 2.228; df 4, 95% = 2.776; df 2, 99% = 9.925
- Example: x̄ 50, s 5, n 11 at 95% (t) gives (46.64, 53.36)
Critical values used by this calculator
Reference values for this calculator.
| Confidence | z* | t* df=4 | t* df=10 | t* df=30 |
|---|---|---|---|---|
| 90% | 1.645 | 2.132 | 1.812 | 1.697 |
| 95% | 1.960 | 2.776 | 2.228 | 2.042 |
| 99% | 2.576 | 4.604 | 3.169 | 2.750 |
The formula
The exact formula this calculator uses — every variable in it is explained in the card below.
The formula
Ideas enhancement: both sampling models are handled in one tool — z for the rare known-σ case and t for the normal unknown-σ case — and the headline outputs are the two interval bounds themselves with the critical value, standard error and margin of error itemised, so an answer engine can verify the interval from the page.
Worked examples
Worked examples with the full working shown — try them in the calculator to check.
Example 1
t interval, the df-10 anchor
x̄ 50, s 5, n 11, 95%, t method
| Calculation | Steps |
|---|---|
| df = 10, so t* = 2.2281 (published table value 2.228). SE = 5/√11 = 1.5076. ME = 2.228 × 1.5076 = 3.359. | 95% CI (46.641, 53.359). |
Result
Example 2
z interval with known sigma
x̄ 100, σ 15, n 36, 95%, z method
| Calculation | Steps |
|---|---|
| z* = 1.96. SE = 15/√36 = 2.5. ME = 1.960 × 2.5 = 4.8999. | 95% CI (95.1001, 104.8999). |
Result
Example 3
Small sample, df 4
x̄ 20, s 4, n 5, 95%, t method
| Calculation | Steps |
|---|---|
| df = 4, so t* = 2.7764 (table value 2.776, much larger than z 1.960). SE = 4/√5 = 1.7889; ME = 4.9667. | 95% CI (15.0333, 24.9667) — wide, as a five-point sample deserves. |
Result
How to use this calculator
Step 1
Enter the sample mean x̄, the standard deviation, and the sample size n.
Step 2
Choose t if the standard deviation comes from the sample (the usual case) or z only if the population σ is truly known.
Step 3
Set the confidence level — 95% is the conventional default.
Step 4
Read the interval bounds as the headline result, and check the margin of error and critical value in the details.
Frequently asked questions
Should I use the z or the t method?
Use t whenever the standard deviation is the sample standard deviation s — almost always in real work. The z method is only correct when the population σ is known from outside the sample. With small samples the difference is large: at n = 11 the 95% t critical value is 2.228 against z = 1.960, so a z interval would be wrongly narrow.
What does “95% confident” actually mean?
It describes the procedure: if the same sampling and interval calculation were repeated many times, about 95% of the intervals produced would contain the true population mean. It is not a 95% probability that this one computed interval contains it — the true mean is fixed, the interval is the random part.
Why does a bigger sample give a narrower interval?
The margin of error is the critical value times s/√n. Quadrupling n halves the standard error, so the interval narrows roughly by half — precision is bought with the square root of the sample size.
How were the t critical values verified?
The t quantiles are computed from the t distribution (via the incomplete beta function) and checked against published t tables: df 10 at 95% gives 2.228, df 4 at 95% gives 2.776, and df 2 at 99% gives 9.925. Those three anchors are built into this tool’s test set, which asserts the interval bounds themselves.
Can I build a confidence interval for a proportion here?
No — this tool is for a population mean. A proportion interval uses p̂ ± z*√(p̂(1−p̂)/n), a different formula; the limitations section states this scope honestly.
About this calculator
A confidence interval calculator turns a sample mean into a range for the unknown population mean: the sample mean plus and minus a margin of error. The margin of error combines how spread out the data are (the standard deviation), how much data you have (n, through the standard error s/√n), and how confident you want to be (the critical value).
The construction is estimate ± critical value × standard error. The standard error s/√n measures how much sample means bounce around from sample to sample; the critical value stretches that by an amount set by the confidence level. At 95%, z* is 1.960, but the t critical value depends on the degrees of freedom n − 1 and is always larger — at df 10 it is 2.228 — because estimating σ from a small sample adds uncertainty that the interval must honestly include.
Choosing the wrong method is the classic error. An earlier build of a tool like this one shipped t critical values that were simply wrong, and nothing caught it because its tests asserted the mean rather than the interval. This calculator’s tests assert the bounds themselves and pin the t quantiles to published tables: df 10 at 95% = 2.228, df 4 at 95% = 2.776, df 2 at 99% = 9.925.
Interpretation matters as much as arithmetic. A 95% interval is the product of a procedure that captures the true mean 95% of the time in repeated sampling. It does not mean 95% of the data lie inside, and widening confidence from 95% to 99% always widens the interval — certainty and precision trade off directly.
Use it whenever a sample average is standing in for a whole population: survey results, lab measurements, quality-control sampling, A/B test averages, or pilot-study outcomes. Use the t method for real samples; reserve z for the textbook case where σ is known from a census or a calibrated process.
How to calculate it yourself
Step 1
Compute the sample mean x̄ and the sample standard deviation s.
Step 2
Decide the method: t with n − 1 degrees of freedom if σ is estimated (usual), z only if σ is known.
Step 3
Look up or compute the critical value for your confidence level (95% t at df 10 is 2.228).
Step 4
Compute the standard error: s ÷ √n.
Step 5
Margin of error = critical value × standard error; the interval is x̄ − ME to x̄ + ME.
Real-life examples
Quality check on a filling line
A drinks producer samples 11 bottles from a line targeting 500 ml and finds x̄ = 502 ml with s = 5 ml. She needs a 95% interval for the true mean fill before adjusting the machine.
Interval (498.641, 505.359) ml.
The whole interval sits above 500 ml, so the line is genuinely overfilling — about 2 ml a bottle of giveaway.
Class test scores
A teacher samples 36 exam scripts from a large cohort: mean 72 marks, and the population standard deviation is known from years of standardised marking to be σ = 9. She wants a 95% interval for the cohort mean.
Interval (69.0601, 74.9399) marks.
The cohort mean is estimated at 72, plausibly between 69.0601 and 74.9399 marks.
Ideas & use cases
- Method comparison: run the same numbers in z and t mode at small n to see exactly how much honesty about σ costs you in width — then watch the gap close as n grows past 30.
- Sample-size planning: hold x̄ and s fixed and raise n until the margin of error fits your decision threshold; the √n law shows why each halving of the margin costs four times the data.
- Confidence trade-off: compute 90%, 95% and 99% intervals for one dataset and compare widths before writing up results, so the confidence level is a deliberate choice, not a default.
Limitations & sources
- For a population mean only — not proportions, differences of means, or regression coefficients. The t interval assumes roughly normally distributed data (or a large enough n for the central limit theorem); badly skewed small samples need a transformation or a bootstrap interval, which this tool does not provide. z mode treats the entered σ as exactly known.
Sources: Standard CI construction for a mean (z and t): OpenStax Introductory Statistics 2e, ch. 8 (Confidence Intervals); t critical values cross-checked against published t-distribution tables (df 10 @95% = 2.228, df 4 @95% = 2.776, df 2 @99% = 9.925); inverse normal via the Acklam algorithm
