Confidence Interval Calculator
Computes a confidence interval for a population mean or a proportion from a sample statistic, a chosen confidence level and the sample size.
Real-time Results
How it works
Build an interval estimate around a sample mean or sample proportion using a fixed z table and your sample size. Results are reported as a lower bound, upper bound and margin of error.
Why does the mean mode use a fixed z instead of a t value?
The engine always multiplies by a z score from its built-in table, even when the standard deviation is a sample value s and n is small. There is no t-distribution option, so intervals for small samples with estimated σ will be narrower than a t-based interval would give. Treat mean-mode output as a large-sample or known-σ approximation.
What happens to proportion bounds near 0 or 1?
In proportion mode the lower bound is floored at 0 and the upper bound capped at 1, but the margin of error is still reported unclipped. So with a small p̂ or small n, lower + margin may not equal upper exactly. The engine also does not check the usual large-sample conditions for the normal approximation.
How are inputs parsed and rounded?
Sample Size is truncated to an integer with floor, so 64.9 becomes 64. Non-numeric or blank numeric fields fall back to 0, and an unrecognized confidence level falls back to z = 1.96. Mean-mode values are formatted with toFixed(4); proportion values are multiplied by 100 and formatted with toFixed(2) plus a % sign.
Examples and interpretation(2)
What is the 90% interval for a mean of 20 with σ = 4 and n = 64?
- Interval Type
- Mean (known σ or large n)
- Confidence Level (%)
- 90%
- Sample Mean (x̄)
- 20
- Standard Deviation (σ or s)
- 4
- Sample Size (n)
- 64
- Set Interval Type to Mean, Confidence Level to 90%, Sample Mean 20, Standard Deviation 4, Sample Size 64.
- z = 1.645; standard error = 4/√64 = 0.5; margin = 1.645 × 0.5 = 0.8225.
- Lower = 20 − 0.8225 = 19.1775; upper = 20 + 0.8225 = 20.8225.
- Lower Bound
- 19.1775
- Upper Bound
- 20.8225
- Margin of Error (±)
- 0.8225
The interval spans 19.1775 to 20.8225 with a margin of 0.8225. Because the engine uses z rather than t, this is a large-sample style interval; it does not account for sampling without replacement or non-normal data.
What is the 95% interval for a proportion of 0.30 with n = 400?
- Interval Type
- Proportion (p̂)
- Confidence Level (%)
- 95%
- Sample Size (n)
- 400
- Sample Proportion (p̂)
- 0.3
- Set Interval Type to Proportion, Confidence Level to 95%, Sample Proportion 0.30, Sample Size 400.
- SE = √(0.30 × 0.70 / 400) ≈ 0.022913; margin = 1.96 × 0.022913 ≈ 0.044909, shown as 4.49%.
- Lower = 0.30 − 0.044909 = 0.255091 → 25.51%; upper = 0.30 + 0.044909 = 0.344909 → 34.49%.
- Lower Bound
- 25.51%
- Upper Bound
- 34.49%
- Margin of Error (±)
- 4.49%
The estimated proportion lies between 25.51% and 34.49% at the chosen level. Enter p̂ as a decimal, not a percentage; entering 30 instead of 0.30 is a common mistake and produces a nonsensical interval.
Inputs
| Parameter | Definition & Valid Bounds |
|---|---|
| Interval Type | Mean (known σ or large n) · Proportion (p̂) |
| Confidence Level (%) | 80% · 85% · 90% · 95% · 99% · 99.9% |
Formula
Mean: x̄ ± z·(σ/√n). Proportion: p̂ ± z·√(p̂(1−p̂)/n), with bounds clipped to [0,1]. z is taken from a fixed table: 80→1.282, 85→1.44, 90→1.645, 95→1.96, 99→2.576, 99.9→3.291.
How to use
- Choose Interval Type: Mean (known σ or large n) or Proportion (p̂).
- Pick a Confidence Level from the list; the matching z value is applied automatically.
- For mean mode, enter Sample Mean (x̄), Standard Deviation (σ or s) and Sample Size (n).
- For proportion mode, enter Sample Proportion (p̂) as a decimal between 0 and 1 and Sample Size (n).
- Read Lower Bound, Upper Bound and Margin of Error (±); mean results use 4 decimals, proportion results use 2 decimals with a % sign.
Frequently asked questions
Does a 95% interval mean there is a 95% chance the true value is inside this specific interval?
No. The level describes the long-run coverage of the procedure across repeated samples. The engine simply applies the fixed z multiplier to your standard error; it makes no probability statement about this particular interval.
Can I enter a confidence level such as 92%?
Only the listed levels (80, 85, 90, 95, 99, 99.9) map to a z value. Any other value falls back to z = 1.96, so a 92% request would silently be computed as if it were 95%.
Why do proportion results show a % sign but mean results do not?
Proportion mode multiplies the bounds and margin by 100 and appends %, so enter p̂ as a decimal. Mean mode reports raw units with four decimals and no unit conversion.
Related Calculators
More calculators selected by category and topic.
