Confidence Interval Calculator
Build a confidence interval for a mean from the sample mean, SD and size.
Results update as you type.
About this calculator
A confidence interval gives a range that is likely to contain the true population mean, estimated from a sample. Instead of a single best guess it reports a band together with a confidence level that says how often such bands capture the true value.
This calculator uses the z-interval: mean ± z*·(σ / √n), where z* is the standard-normal critical value for your chosen confidence level (1.645 for 90%, 1.96 for 95%, 2.576 for 99%) and σ / √n is the standard error. It reports the bounds, the margin of error and the standard error, and a table shows the interval at the 90%, 95% and 99% levels so you can see how the range widens as you demand more confidence.
Worked example: a sample mean of 100 with a standard deviation of 15 and 50 observations has a standard error of 15 ÷ √50 ≈ 2.12. At 95% confidence the margin is 1.96 × 2.12 ≈ 4.16, giving an interval of about 95.84 to 104.16. The z-interval suits large samples (roughly n ≥ 30) or a known population standard deviation; for small samples use a t-interval instead.
Frequently asked questions
What does a 95% confidence interval mean?
It means that if you repeated the sampling many times and built an interval each time, about 95% of those intervals would contain the true population mean. It does not mean there is a 95% probability the mean is in this one particular interval.
When should I use a t-interval instead?
Use a t-interval when the sample is small (roughly under 30) and the population standard deviation is unknown. The t-distribution has heavier tails, giving a slightly wider, more cautious interval than this z-based one.
What is the margin of error in a confidence interval?
The margin of error is the half-width of the interval, z*·(σ / √n). You add and subtract it from the sample mean to get the upper and lower bounds, so a smaller margin means a more precise estimate.
How do I make a confidence interval narrower?
Collect a larger sample, since the width shrinks with the square root of n, or accept a lower confidence level. Reducing the variability in your data also tightens the interval. Quadrupling the sample size roughly halves the width.
Does a higher confidence level make the interval wider?
Yes. Demanding more confidence uses a larger critical value z*, so a 99% interval is wider than a 95% interval built from the same data. There is always a trade-off between confidence and precision.
What is the standard error?
The standard error is the standard deviation divided by the square root of the sample size (σ / √n). It measures how much the sample mean itself would vary from sample to sample, and it is the building block of the margin of error.
API — use this calculator from code
Call this calculator as a free JSON endpoint — no key required. Send the field values below as query parameters or JSON. Read the full API docs →
Endpoint
GET https://calculator.free/api/v1/confidence-interval/
curl
curl "https://calculator.free/api/v1/confidence-interval/?mean=100&sd=15&n=50&conf=1.96"
JavaScript fetch()
const r = await fetch(
"https://calculator.free/api/v1/confidence-interval/?" + new URLSearchParams({
"mean": "100",
"sd": "15",
"n": "50",
"conf": "1.96"
}));
const data = await r.json();
console.log(data.results);
Results are estimates for general guidance only, not financial, medical or tax advice.