SahlCalc سهل
Gulf Hubs:

Saudi Arabia: Labour: HRSD · Tax and zakat: ZATCA

Confidence Interval Calculator

Work out a confidence interval and margin of error for a mean or a proportion from your sample, at any confidence level.

Interval for

The average of your sample, e.g. 50

Greater than 0, in the same units as the mean, e.g. 10

Standard deviation is

Number of observations, 2 or more, e.g. 25

%

Between 0 and 100, usually 90, 95 or 99

95% confidence interval

45.8722 – 54.1278

Margin of error

± 4.1278

Standard error

2

Critical value t*(24)

2.0639

Formula with your numbers

  • Standard error = 10 ÷ √25 = 2
  • Interval = 50 ± 2.0639 × 2 = 50 ± 4.1278

Quick answer: A sample of 25 with mean 50 and standard deviation 10 gives a 95% interval of 50 ± 2.0639 × 10 ÷ √25 = 50 ± 4.1278, so 45.8722 to 54.1278.

How it's calculated

Mean: x̄ ± critical value × SD ÷ √n. When the standard deviation comes from the sample, the critical value is Student's t with n − 1 degrees of freedom (2.0639 for 95% and n = 25); when the population σ is known, it is z (1.96 for 95%). Some calculators always use z; for small samples that gives an interval that is too narrow, so choose “Known σ (z)” only when σ really is known.

Proportion: p̂ ± z·√(p̂(1 − p̂) ÷ n), the Wald interval. The Wilson score interval is shown alongside; it behaves better when n is small or p̂ is near 0% or 100%.

A 95% confidence level means that intervals built this way contain the true value in 95% of samples. A higher level or a smaller sample gives a wider interval. To plan how many responses you need for a given margin, use the sample size calculator.

Worked examples

  • x̄ = 50, s = 10, n = 25, 95%: 50 ± 4.1278 → 45.8722 – 54.1278
  • Same with known σ = 10: 50 ± 1.96 × 2 = 50 ± 3.9199
  • 520 yes out of 1,000, 95%: 52% ± 3.1% → 48.9% – 55.1%

Critical values (two-sided)

Confidencez*t* (df = 10)t* (df = 30)
90%1.6451.8121.697
95%1.9602.2282.042
99%2.5763.1692.750

Frequently asked questions

Should I use z or t?

Use t when the standard deviation is estimated from your sample, which is almost always. Use z only when the population standard deviation is genuinely known. For large samples the two are nearly the same.

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

Strictly, the 95% describes the method: 95% of intervals made this way contain the true value. Any one interval either contains it or not.

How can I make the interval narrower?

Collect a larger sample (the margin shrinks with √n) or accept a lower confidence level.

What is the margin of error?

Half the width of the interval. With a mean of 50, an SD of 10 and 25 people at 95%, it's about 4.13, so you'd report 50 ± 4.13.

How many people should I survey?

Use the sample size calculator. Tell it the margin of error and confidence you're after and it gives you the number of responses.

What changes between a 95% and a 99% interval?

The 99% one is wider. You're more confident it holds the true value, but you pay for it in precision.