Skip to content
PercentPoint

Confidence Interval Calculator

Build a confidence interval for a population mean or a proportion from your sample. Choose z or t for a mean, or the standard or plus-four method for a proportion, and get the interval, the margin of error, the critical value and the standard error.

For planning only. Your school, syllabus or accountant has the final word. First published · Last reviewed by PercentPoint.

How to use the confidence interval calculator

  1. Choose Mean or Proportion. Use Mean for measurements such as scores, weights or times. Use Proportion for yes-or-no data such as the share of people who own a smartphone.
  2. Enter the sample results. For a mean: the sample mean, sample size and standard deviation, and whether that standard deviation comes from your sample (t) or is a known population value (z). For a proportion: the number of successes and the sample size.
  3. Pick a confidence level. 95% is the usual choice; 90% gives a narrower interval and 99% a wider one.

The calculator opens on OpenStax’s exam-score example (Introductory Statistics 2e, Examples 8.2 and 8.4): a sample of 36 scores with a mean of 68 and a known population standard deviation of 3. At 95% confidence the interval is 67.02 to 68.98.

What a confidence interval is

A sample mean or proportion is a point estimate of the population value, and it won’t hit it exactly. A confidence interval adds a margin of error, which the textbook calls the error bound, on each side:

point estimate − error bound  to  point estimate + error bound

Example 8.1 puts it simply: a sample mean of 7 with an error bound of 2.5 gives the interval (4.5, 9.5). At a 95% confidence level, we would say, “We estimate with 95% confidence that the true population mean is between 4.5 and 9.5.”

The 95% describes the method, not the one interval. If you took many samples and built an interval from each, about 95% of those intervals would contain the true value. Any single interval either contains it or doesn’t.

Interval for a mean: z or t

The error bound for a mean is the critical value times the standard error:

EBM = z × σ ÷ √n   (σ known)    EBM = t × s ÷ √n   (σ unknown)

Known σ (section 8.1). In Example 8.2, σ = 3 and n = 36, so the standard error is 3 ÷ 6 = 0.5. At 90% confidence z = 1.645, the error bound is 0.8225, and the interval is (67.18, 68.82). At 95%, z = 1.96 and the interval widens to (67.02, 68.98).

Unknown σ (section 8.2). In practice you rarely know the population standard deviation, so you use the sample’s, s, and replace z with a value from Student’s t distribution with n − 1 degrees of freedom. The t value is larger than z for small samples, which widens the interval to account for the extra uncertainty. In Example 8.8, 15 subjects have a mean of 8.2267 and s = 1.6722. With 14 degrees of freedom, t ≈ 2.14 at 95%, the error bound is about 0.926, and the interval is (7.30, 9.15).

As the sample grows, t approaches z: with 100 degrees of freedom the 95% t value is about 1.98, close to 1.96.

Interval for a proportion

For yes-or-no data, the sample proportion is p′ = x ÷ n, and the error bound uses the normal approximation (section 8.3):

EBP = z × √(p′(1 − p′) ÷ n)

In Example 8.11, 300 of 500 students surveyed are registered voters, so p′ = 0.60. At 90% confidence the error bound is 1.645 × √(0.6 × 0.4 ÷ 500) ≈ 0.036, and the interval is 56.4% to 63.6%. In Example 8.10, 421 of 500 adults own a smartphone; at 95% confidence the interval runs from about 81.0% to 87.4%.

Plus-four method. With small samples or proportions near 0% or 100%, the standard interval can be too narrow. The textbook’s fix is to add two successes and two failures before computing: in Example 8.12, 6 smokers out of 25 becomes 8 out of 29. Switch on “Plus-four method” to use it.

What makes an interval wider or narrower

  • Higher confidence, wider interval. Going from 90% to 95% to 99% raises the critical value from 1.645 to 1.96 to 2.576.
  • Larger sample, narrower interval. The error bound shrinks with √n, so quadrupling the sample halves it. Example 8.5 shows this with n = 100 instead of 36.
  • More variable data, wider interval. A larger standard deviation means a larger standard error.

To plan a study around a target margin of error, work backward with the sample size calculator.

When the formulas apply

Both kinds of interval assume a random sample. The t interval assumes the population is roughly normal, which matters most for small samples; with a few dozen values or more it is fairly robust. The proportion interval needs enough successes and failures, at least about five of each, for the normal approximation to hold. The calculator warns when a proportion sample falls short, and the plus-four method helps in that case.

Step by step: the default example

  1. Standard error: σ ÷ √n = 3 ÷ √36 = 3 ÷ 6 = 0.5.
  2. Critical value: for 95% confidence, 2.5% is left in each tail, so z = 1.96.
  3. Error bound: 1.96 × 0.5 = 0.98, the value the textbook finds in Example 8.4.
  4. Interval: 68 − 0.98 = 67.02 and 68 + 0.98 = 68.98.

Switch “Standard deviation is” to “Sample (t)” and the critical value becomes t with 35 degrees of freedom, about 2.03, which widens the interval slightly to roughly 66.98 to 69.02.

Reporting the result

A complete statement names the parameter, the interval, the confidence level and the population: “We estimate with 95% confidence that the mean exam score of all students is between 67.02 and 68.98.” Avoid saying there is a 95% probability that the true mean is in that particular interval. For surveys, the result is often written as an estimate plus or minus the margin of error, such as 60% ± 3.6 points at 90% confidence. Round the endpoints sensibly: one or two more decimal places than the original data is usually enough.

Common critical values

Confidencezt, 10 dft, 30 df
90%1.6451.8121.697
95%1.9602.2282.042
99%2.5763.1692.750

The t values sit above the matching z value but close in on it as the degrees of freedom grow. With 10 degrees of freedom, a 95% interval is about 14% wider than the z interval would be; with 30, about 4% wider. The calculator works out t for any sample size, so you don’t need a printed table, but the pattern explains why small samples give wide intervals.

Sources & assumptions

How this calculator gets its numbers. Full method: our methodology.

  • Mean with a known population standard deviation uses z; with a sample standard deviation it uses Student’s t with n − 1 degrees of freedom.
  • Proportion intervals use the normal approximation p′ ± z√(p′q′/n), clipped to 0–100%; plus-four adds 2 successes and 4 trials.
  • Assumes a random sample; critical values are computed, not rounded from a table.

Sources

  1. OpenStax (Rice University), Introductory Statistics 2e, 8.1 A Single Population Mean Using the Normal Distribution. Error bound z·σ/√n (Example 8.2: 90% → (67.18, 68.82); Example 8.4: 95% → (67.02, 68.98)) and sample size n = z²σ²/EBM² (Example 8.7: 216.09 → 217).
  2. OpenStax (Rice University), Introductory Statistics 2e, 8.2 A Single Population Mean Using the Student t Distribution. t interval with n − 1 degrees of freedom; Example 8.8: 15 subjects, x̄ = 8.2267, s = 1.6722, t = 2.14 → (7.30, 9.15).
  3. OpenStax (Rice University), Introductory Statistics 2e, 8.3 A Population Proportion. Proportion interval p′ ± z√(p′q′/n) (Example 8.10: 421 of 500; Example 8.11: 300 of 500 at 90% → (0.564, 0.636)), the plus-four method (Example 8.12) and sample size with p′ = 0.5 (Example 8.14: 752).

Last reviewed . Textbook answers that use z = 1.645 or 1.96 from a table can differ in the last digit.

Frequently asked questions

How do I calculate a 95% confidence interval?

Take the sample mean and add and subtract 1.96 × σ ÷ √n if σ is known, or t × s ÷ √n with n − 1 degrees of freedom if it isn’t. For a proportion, use p′ ± 1.96 × √(p′(1 − p′) ÷ n).

Should I use z or t?

Use t when the standard deviation comes from your sample, which is the usual case. Use z only when the population standard deviation is known.

What is the margin of error?

Half the width of the confidence interval: the critical value times the standard error. A poll reported as 60% ± 3.6% has a margin of error of 3.6 percentage points.

Does a 95% interval mean a 95% chance the true value is inside?

Not exactly. It means the method produces intervals that capture the true value about 95% of the time over many samples.

How can I make my confidence interval narrower?

Collect a larger sample or accept a lower confidence level. Quadrupling the sample size halves the margin of error.

What is the plus-four method?

A small-sample adjustment for proportions: add 2 to the successes and 4 to the sample size before computing the interval.