Percentages and Math

Confidence Interval and Sample Size Calculator

Enter your sample numbers and a confidence level to get the interval, margin of error and the critical value used.

Your numbers

What do you have

Between 50 and 99.99.

The sample standard deviation, or the population value if you know it.

Result

95% confidence interval for the mean

68.285 to 75.715

Mean 72 with a margin of error of 3.715

Sample mean
72
Margin of error
3.715
Lower bound
68.285
Upper bound
75.715
Standard error
1.8
t critical value (24 degrees of freedom)
2.0639
How this was calculated
  1. Standard error = standard deviation / square root of n = 9 / 5 = 1.8.
  2. The critical value is t = 2.0639 for 24 degrees of freedom.
  3. Margin of error = 2.0639 x 1.8 = 3.715.
  • Assumes a simple random sample. A confidence interval describes the method, not a probability that this one interval contains the true value, and it does not cover bias or poor sampling.
  • With fewer than 30 values the interval relies on the data being roughly normal. Check for outliers before trusting it.

Calculated using SumPanda.com · https://sumpanda.com/confidence-interval-calculator/

Results are estimates for general information. Verify important figures before relying on them.

Next step

How to use the confidence interval and sample size calculator

  1. Choose what you have: Mean, SD and sample size, A list of values, Successes out of a sample, or Find the sample size for a mean.
  2. Set the confidence level, such as 95.
  3. Enter your numbers. For a list, paste the values separated by commas, spaces or new lines and the tool finds the mean and sample standard deviation itself.
  4. Read the interval, the margin of error and the critical value. Tick the known population standard deviation box only if you really know it, which switches from t to z.

Formula

Standard error = standard deviation / square root of n

Interval for a mean = mean +/- t x standard error, with t from n - 1 degrees of freedom (z if sigma is known)

Wilson interval for a proportion = (p + z^2/2n +/- z x square root of (p(1-p)/n + z^2/4n^2)) / (1 + z^2/n)

Normal approximation = p +/- z x square root of (p(1-p)/n)

Sample size for a mean = (z x standard deviation / margin of error)^2, rounded up

The t critical value comes from the exact Student t distribution, found numerically, not from a rounded table.

Worked example

A sample of 25 values has a mean of 72 and a standard deviation of 9. The standard error is 9 / 5 = 1.8 and t for 24 degrees of freedom at 95% is 2.0639. The margin is 3.715, so the interval is 68.285 to 75.715.

For a proportion, 42 successes in 120 trials gives 35%. The Wilson 95% interval is 27.05% to 43.88%, and the normal approximation gives 26.47% to 43.53%. To estimate a mean with a standard deviation of 15 to within 2 at 95% confidence, you need 217 observations.

What a confidence interval means

A 95% confidence interval comes from a method that, over many repeated samples, captures the true value about 95% of the time. It does not say there is a 95% chance this particular interval holds the true value. A wider interval means more uncertainty, which comes from a smaller sample, more variation or a higher confidence level.

Choosing t or z

When you estimate the standard deviation from the sample, as almost everyone does, the t distribution is the correct choice and gives a wider interval for small samples. If the population standard deviation is truly known, use z. As the sample grows the two agree. For z-scores and probabilities see the z-score calculator, and for survey planning see the sample size calculator.

Proportions and small samples

The simple normal approximation can run below 0% or above 100% and performs poorly when there are few successes or failures. The Wilson interval stays within range and is the one shown first. Find the spread of your own data with the standard deviation calculator or the descriptive statistics calculator.

Assumptions and limits

  • The data are a simple random sample. A biased or convenience sample can be badly wrong however narrow the interval.
  • For means, the values are roughly normal, or the sample is large enough for the central limit theorem to apply.
  • For proportions, each trial is independent with the same chance of success.
  • Samples below two values, successes above the sample size and confidence levels outside 50 to 99.99 are rejected.

Formulas reviewed October 10, 2026. See the calculation methodology for how SumPanda rounds, tests and sources its formulas.

Frequently asked questions

How do I calculate a confidence interval for a mean?

Divide the standard deviation by the square root of the sample size, multiply by the t critical value for n - 1 degrees of freedom, then add and subtract that margin from the mean.

What is the t value for 95% confidence with 24 degrees of freedom?

It is 2.0639. For 9 degrees of freedom it is 2.2622, and for 1 degree of freedom it is 12.7062. The value approaches 1.96 as the sample grows.

What confidence level should I use?

Ninety five percent is the usual choice. Use a higher level such as 99% when a wrong conclusion is costly, accepting a wider interval, and a lower level when you want a tighter range and can tolerate more risk.

How does sample size change the interval?

The margin shrinks with the square root of n, so quadrupling the sample halves the margin. Going from 25 to 100 observations roughly cuts the margin in half.