Confidence Interval Calculator

When you're working with data, you rarely have access to an entire population. Instead, you take a sample and use it to make educated guesses about the bigger picture. A confidence interval gives you a range of values that likely contains the true population parameter, based on your sample data. This calculator takes the guesswork out of the math. Plug in your sample mean, standard deviation, sample size, and confidence level, and you'll get a precise interval right away. Whether you're a student, researcher, or analyst, the tool works the same way. The sections below walk you through how confidence intervals work, what goes into the formula, and how to actually read the results once you have them.

Enter Details

Result

Enter your sample statistics to find the confidence interval.

Uses the z-distribution (large-sample / known σ). For small samples, use a t-interval instead.

What Is a Confidence Interval?

A confidence interval is a range of values, calculated from sample data, that's likely to contain the true value of a population parameter. That parameter is usually a mean or proportion. The interval has a lower bound and an upper bound, with your sample estimate sitting somewhere in the middle.

The "confidence" part refers to how often this method produces an interval that actually captures the true value. A 95% confidence interval, for example, means that if you repeated your sampling process 100 times and built an interval each time, roughly 95 of those intervals would contain the true population mean. It does not mean there's a 95% chance the true value falls within your specific interval.

Confidence intervals are useful because they communicate uncertainty honestly. A single point estimate, like a sample mean, tells you nothing about how reliable it is. The interval tells you how wide the plausible range of true values actually is, which is far more informative.

  • Narrow interval: your estimate is fairly precise, usually because your sample was large or the data wasn't very spread out
  • Wide interval: there's more uncertainty, often because the sample was small or the data was highly variable

How to Calculate a Confidence Interval

Calculating a confidence interval follows a straightforward process once you have your sample data in hand. Here's the general sequence:

  1. Collect your sample and record the sample mean (x̄) and sample standard deviation (s)
  2. Note the sample size (n)
  3. Choose your confidence level (commonly 90%, 95%, or 99%)
  4. Find the appropriate critical value (z* or t*) for your chosen confidence level
  5. Calculate the standard error by dividing the standard deviation by the square root of n
  6. Multiply the critical value by the standard error to get the margin of error
  7. Subtract the margin of error from the sample mean to get the lower bound; add it to get the upper bound

The result is your confidence interval: (x̄ minus margin of error, x̄ plus margin of error). When you use a calculator or software, these steps happen behind the scenes instantly. But understanding each one helps you know which inputs matter and why changing them shifts your results.

One thing to keep in mind: this process assumes your data is roughly normally distributed, or that your sample size is large enough for the Central Limit Theorem to apply (generally n ≥ 30 is a common benchmark, though it's not a hard rule).

Confidence Interval Formula Explained

The standard formula for a confidence interval for a population mean looks like this:

CI = x̄ ± z* × (s / √n)

Let's break down each piece:

  • x̄ (sample mean): the average value from your sample data, serving as the center point of the interval
  • z* (critical value): a number tied to your confidence level, pulled from a standard normal distribution (or a t-distribution when the sample is small)
  • s (sample standard deviation): a measure of how spread out the values in your sample are
  • n (sample size): how many observations are in your sample
  • s / √n (standard error): this adjusts the standard deviation to reflect the variability of the sample mean, not individual data points

When your sample size is small (typically under 30) or the population standard deviation is unknown, you swap the z* value for a t* value from the t-distribution. The t-distribution has heavier tails, which produces a wider interval to account for the extra uncertainty that comes with small samples.

For proportions rather than means, the formula changes slightly. Instead of the sample standard deviation, you use √(p̂(1 - p̂) / n), where p̂ is the sample proportion. The structure is the same; just the standard error calculation differs.

Margin of Error Calculation

The margin of error is the part of the confidence interval formula that determines how wide your interval is. It's calculated as:

Margin of Error (E) = z* × (s / √n)

Think of it as the "plus or minus" number you often hear in polling. When a news report says a candidate has 52% support "plus or minus 3 points," that 3 points is the margin of error.

Three things directly control the margin of error:

  • Confidence level: higher confidence means a larger critical value, which widens the margin
  • Standard deviation: more variability in your data pushes the margin of error up
  • Sample size: larger samples shrink the margin of error, since you're dividing by a bigger square root

If your margin of error comes out wider than you'd like, increasing the sample size is usually the most practical fix. Doubling the sample size doesn't halve the margin of error, though. Because you're taking a square root, you'd need to quadruple your sample size to cut the margin of error in half. That's worth knowing before you plan data collection.

Confidence Level and Critical Values

The confidence level you choose directly controls how wide your interval is. It also tells you which critical value to use in the formula. Here are the most common pairings:

Confidence Levelz* (Critical Value)
90%1.645
95%1.960
99%2.576

A 95% confidence level is by far the most common choice in research and statistics. It strikes a reasonable balance between precision and certainty. Going up to 99% gives you more confidence but widens the interval, sometimes to the point where it's not very useful. Dropping to 90% tightens things up but at the cost of being wrong more often.

When you're working with a small sample and you don't know the population standard deviation, you use a t* critical value instead. The t* value depends on both the confidence level and the degrees of freedom (which is n minus 1). As sample size grows, t* converges toward the z* value, so the distinction matters most when n is small.

Choosing a confidence level is a judgment call based on the stakes of your analysis. Medical research often demands 99% or higher. Marketing surveys might be perfectly fine at 90%. There's no universally "correct" level; it depends on how much uncertainty you can tolerate.

Sample Size and Its Impact on Confidence Intervals

Sample size is one of the biggest levers you have when designing a study or survey. It directly affects the standard error, which in turn controls how wide or narrow your confidence interval ends up.

Larger samples produce narrower intervals. That's the simple version. A sample of 1,000 will give you a tighter, more precise estimate than a sample of 50, assuming everything else stays the same. The math behind this is the √n in the denominator of the standard error. As n grows, that denominator grows, and the standard error shrinks.

Here's a practical illustration. Say your sample standard deviation is 15 and you're using a 95% confidence level (z* = 1.96):

Sample Size (n)Standard ErrorMargin of Error
253.005.88
1001.502.94
4000.751.47
1,6000.3750.74

Notice that to cut the margin of error in half each time, you need to quadruple the sample size. Returns diminish quickly. At some point, the cost of collecting more data outweighs the gain in precision. That's why researchers often do a power analysis before data collection to find the minimum sample size that meets their precision goals without wasting resources.

Confidence Interval Calculation Examples

A couple of concrete examples make the formula a lot easier to follow.

Example 1: Mean Test Score

A teacher samples 36 students and records their exam scores. The sample mean is 78 and the sample standard deviation is 12. She wants a 95% confidence interval.

  • n = 36, x̄ = 78, s = 12, z* = 1.96
  • Standard error = 12 / √36 = 12 / 6 = 2.0
  • Margin of error = 1.96 × 2.0 = 3.92
  • Confidence interval = (78 - 3.92, 78 + 3.92) = (74.08, 81.92)

She can say with 95% confidence that the true mean test score for the class falls between about 74 and 82.

Example 2: Customer Satisfaction Proportion

A company surveys 200 customers and finds that 140 of them (70%) rate their experience as satisfactory. They want a 99% confidence interval for the true proportion.

  • n = 200, p̂ = 0.70, z* = 2.576
  • Standard error = √(0.70 × 0.30 / 200) = √(0.00105) ≈ 0.0324
  • Margin of error = 2.576 × 0.0324 ≈ 0.0834
  • Confidence interval = (0.70 - 0.0834, 0.70 + 0.0834) = (0.617, 0.783)

So the company can say with 99% confidence that between about 62% and 78% of all customers are satisfied. That's a fairly wide range, which reflects both the high confidence level and the moderate sample size.

How to Interpret Confidence Intervals

Getting a confidence interval is one thing. Reading it correctly is another, and this is where a lot of people slip up.

A 95% confidence interval does not mean there's a 95% probability the true value is inside your specific interval. Once you've calculated an interval from your sample, it either contains the true value or it doesn't. The probability refers to the method, not the specific result. If you used this procedure many times across many samples, 95% of those intervals would capture the true parameter.

What you can say: you used a method that captures the true mean 95% of the time, and your current interval is the result of applying that method to your data.

A few practical takeaways for interpreting results:

  • Narrow intervals are more informative. They mean your estimate is precise. A wide interval often signals you need more data.
  • If two intervals don't overlap, the difference between the two groups is likely statistically significant. Overlapping intervals don't automatically mean the opposite, though.
  • The interval is centered on your sample estimate, so a value far from the center is still within the interval but less likely to be the true population value.
  • Context matters. A margin of error of ±5 points might be totally acceptable in one situation and unacceptably large in another, depending on what decision you're making with the data.

Bottom line: a confidence interval tells you where the true value plausibly lives, given your data and your chosen confidence level. Use it as a range, not a guarantee, and you'll interpret it the right way.

Other Maths Calculators

Explore all