Confidence Interval: What It Means and How to Calculate It for Survey Data

Contents
Confidence Interval: What It Means and How to Calculate It for Survey Data

A confidence interval is a range around a survey result that shows how precisely your sample estimates the value in the whole population: 62% of 400 respondents becomes about 57% to 67% at 95% confidence. The 95% describes the method, not one particular interval. Below you will find the formulas for a percentage and for a mean rating, worked examples you can repeat in our calculator, a table of widths by sample size and the right way to compare two groups.

Key points

  • A confidence interval is the estimate plus and minus a margin of error. For a symmetric interval, the margin of error is half its width.
  • "95% confidence" is a property of the procedure: across many samples, about 95% of intervals built this way contain the true value. It does not give a 95% chance to the one interval you computed.
  • Width shrinks with the square root of the sample size: at 50%, the 95% margin is ±9.8 points with 100 answers and ±4.9 with 400.
  • Two intervals can overlap while the difference between the groups is still significant. Check the interval of the difference.
  • The interval covers random sampling error only. For an opt-in sample, or a question that leads people to an answer, it understates the real uncertainty.

What is a confidence interval?

A confidence interval is a range of plausible values for a population number, calculated from a sample. It has three parts: the point estimate (the result you measured), the margin of error (how far the true value could reasonably be from it) and the confidence level (how often the method succeeds, usually 95%).

Here is the example used throughout this article (example data). You survey 400 customers, and 248 of them, 62%, say they would use a self-service portal. The 95% margin of error for that result is 4.8 percentage points, so the confidence interval runs from 57.2% to 66.8%. Read it this way: the survey supports any share of "yes" among all customers from roughly 57% to 67%, and values outside that range fit the data poorly.

The interval is about the population percentage. It says nothing about individual respondents, and it only reflects the randomness of who ended up in the sample. If the question was worded in a leading way, or only your happiest customers answered, the interval will be narrow and still wrong.

What does a 95% confidence interval mean?

A 95% confidence interval comes from a method that captures the true population value in about 95% of samples. If you ran the same survey again and again, each time with a new random sample, and built an interval each time, roughly 95 out of 100 of those intervals would contain the true value. Penn State's STAT 100 lesson on confidence intervals calls this the coverage probability and says it is what the confidence level means.

The chart shows the idea on a simulated population in which exactly 60% would say yes. We drew 20 random samples of 400 people and built a 95% interval for each. Nineteen intervals cover 60%. One sample happened to get only 54.3% "yes", and its interval, 49.4% to 59.1%, misses the true value. Nothing in that sample's data warned that it was the unlucky one.

Twenty simulated surveys of 400 people from a population where 60% say yes. Nineteen 95% confidence intervals cover 60%; one sample with 54.3% yes has an interval of 49.4% to 59.1% and misses the true value.

For the one interval you calculated, the true value is either inside it or not: you cannot attach a 95% probability to it. Two other readings are also wrong. The interval does not contain 95% of respondents, since it describes a percentage, not people. And it does not cover errors from wording, nonresponse or self-selection.

The 95% level is a convention. The U.S. Census Bureau, for example, notes in its basic explanation of confidence intervals (revised 2021) that it routinely uses 90% intervals. A higher level gives a wider interval; a lower level gives a narrower one that misses more often.

Confidence interval formula for a proportion

For a survey percentage, the textbook formula is p ± z × √( p(1 − p) / n ). Here p is the share as a decimal, n is the number of respondents who answered the question, and z is the critical value for the confidence level: 1.645 for 90%, 1.96 for 95% and 2.576 for 99%. This simple version is often called the Wald interval.

For the portal question, 248 "yes" answers out of 400:

  1. Share: p = 248 / 400 = 0.62.
  2. Standard error: √( 0.62 × 0.38 / 400 ) = √0.000589 = 0.0243.
  3. Margin of error: 1.96 × 0.0243 = 0.0476, or 4.8 percentage points.
  4. Interval: 62% − 4.8 = 57.2% and 62% + 4.8 = 66.8%.

The margin of error calculator gives the same ±4.8% for 400 responses and an expected share of 62%. Two conditions sit behind the formula: respondents were drawn at random from the population, and each answer is independent of the others. Use the number of people who answered this question as n, not the number who opened the survey.

Wilson interval: small samples and results near 0% or 100%

When you have few respondents, or a share close to 0% or 100%, use the Wilson score interval instead of the simple formula. It never goes below 0% or above 100%, and its real coverage stays closer to the level you asked for.

Suppose 2 of 25 beta testers (8%) report a bug. The simple formula gives 8% ± 10.6 points, from −2.6% to 18.6%. A negative share is impossible. The Wilson interval for the same data runs from 2.2% to 25.0%: it is asymmetric, with more room above the result than below it, which is how uncertainty behaves near zero.

The Wilson bounds are a centre plus and minus a half-width:

PartFormula
Centre( p + z²/2n ) / ( 1 + z²/n )
Half-widthz / ( 1 + z²/n ) × √( p(1 − p)/n + z²/4n² )
Boundscentre ± half-width

The NIST/SEMATECH e-Handbook of Statistical Methods warns that the lower limit of the common formula can be negative and presents the Wilson method as a fix. Brown, Cai and DasGupta compared the options in Statistical Science (2001): they found the coverage of the simple interval erratic, more persistently than textbooks suggest, and recommended the Wilson interval or the Jeffreys interval for small n. Our confidence interval calculator uses the Wilson method. Enter 62 and 400 and it shows 57.2% to 66.6%, that is −4.8 and +4.6 points. With 400 respondents and a share near the middle, both methods agree to within a few tenths of a point; with 25 respondents they do not.

How to calculate a confidence interval for a mean rating

For an average score, the interval is x̄ ± t × s / √n, where x̄ is the mean, s is the sample standard deviation and t is the critical value of Student's t distribution with n − 1 degrees of freedom. With a hundred or more respondents, t is close to 1.96.

Example data: 120 new users rate onboarding on a 1–10 scale. The mean is 7.4 and the standard deviation 1.9 (our guide to standard deviation shows how to get it, and the standard deviation calculator returns both numbers from a pasted column).

  1. Standard error: 1.9 / √120 = 1.9 / 10.95 = 0.173.
  2. Critical value: t for 95% and 119 degrees of freedom = 1.980.
  3. Margin: 1.980 × 0.173 = 0.343.
  4. Interval: 7.4 ± 0.34, from 7.06 to 7.74.

In Excel, CONFIDENCE.T returns the margin for you: =CONFIDENCE.T(0.05, 1.9, 120) gives 0.343, which you then add to and subtract from the mean. The formula assumes roughly normal data or a sample large enough for the mean to behave normally. It fits scale scores built from several items. For 0–10 and 1–10 ratings, using the mean is a judgment call: it treats the steps between points as equal. If that worries you or your readers, report the share of 9s and 10s with a proportion interval instead. For a single 5-point agreement item, which is ordinal, a safer summary is the share who agree (the top two boxes) with a proportion interval.

How sample size and confidence level change the width

The width of a confidence interval shrinks with the square root of the sample size, so four times the respondents gives half the margin. It also depends on the result itself: a share near 50% has the widest interval, and a share near 0% or 100% the narrowest. For a mean rating, the interval also grows with the standard deviation: twice the spread gives twice the margin.

The table gives the 95% margin of error and the Wilson interval for two results, 50% and 20%, at four sample sizes. Use it to judge what your number of responses can and cannot tell apart.

ResponsesResult 50%Result 20%
100±9.8 (40.4–59.6)±7.8 (13.3–28.9)
200±6.9 (43.1–56.9)±5.5 (15.0–26.1)
400±4.9 (45.1–54.9)±3.9 (16.4–24.2)
1,000±3.1 (46.9–53.1)±2.5 (17.6–22.6)

Two patterns stand out. Going from 100 to 400 responses cuts the margin in half, while going from 400 to 1,000 buys only about 1.8 more points at 50%. And at 20% the Wilson interval is lopsided at small n: 13.3% to 28.9% with 100 responses sits 6.7 points below the result and 8.9 above it.

The 95% margin of error falls as responses grow: for a 50% result it is ±9.8 points at 100 responses, ±6.9 at 200, ±4.9 at 400 and ±3.1 at 1,000; for a 20% result ±7.8, ±5.5, ±3.9 and ±2.5.

The confidence level works the other way. For the portal result, 62% of 400, the Wilson interval is 57.9% to 65.9% at 90%, 57.2% to 66.6% at 95% and 55.6% to 68.0% at 99%. If you are still planning a survey and need to choose how many people to invite, our sample size guide works backwards from the margin you want.

Comparing two groups: do overlapping confidence intervals mean no difference?

No. When two 95% intervals do not overlap, the difference between the groups is significant at the 5% level. When they overlap, the difference can still be significant. To compare two groups, look at the confidence interval of the difference, or run a test.

Example data: 232 of 400 customers on the annual plan (58%) and 200 of 400 on the monthly plan (50%) say they would recommend you. The Wilson intervals are 53.1% to 62.7% and 45.1% to 54.9%. They overlap between 53.1% and 54.9%, and a quick look would call it a tie.

The interval of the difference gives another answer. The difference is 8 points, with a standard error of √( 0.58 × 0.42 / 400 + 0.50 × 0.50 / 400 ) = 0.0351, so its 95% interval is 8 ± 6.9, from 1.1 to 14.9 points. Zero is outside, so the difference is significant. A two-proportion z-test agrees: z = 2.27, p = .023.

Annual plan 58% with a 95% interval of 53.1% to 62.7%, monthly plan 50% with 45.1% to 54.9%. The intervals overlap, yet the difference of 8 points has a 95% interval of 1.1 to 14.9 points, which excludes zero (p = .023).

Penn State's lesson calls the no-overlap rule the "more conservative" of the two checks: it misses real differences that the interval of the difference catches. The interval of the difference also serves as the effect size. Here it says the annual plan's lead could be as small as 1 point or as large as 15, which is a wide range for a business decision. You can repeat the test in the A/B significance calculator by entering respondents as visitors and "yes" answers as conversions; it returns p = 0.0232. Our article on the p-value explains how to read that number. These formulas are for independent groups. For the same people asked twice, use a paired method, and for two mean ratings the t-test.

How to report a confidence interval

Report the estimate first, then the confidence level and the two limits in square brackets, then n. Name the method when it is not the textbook one. Square brackets around the limits follow APA Style (7th edition), as summarised in Purdue OWL's guide to statistics in APA. These sentences cover the three examples above and can go straight into a report or a thesis results chapter:

  • 62% of customers would use a self-service portal, 95% CI [57.2%, 66.6%] (Wilson), n = 400.
  • Onboarding was rated M = 7.40, 95% CI [7.06, 7.74], SD = 1.90, n = 120.
  • Annual-plan customers recommended us more often than monthly-plan customers (58% vs 50%), difference 8 points, 95% CI [1.1, 14.9], z = 2.27, p = .023.

In a methods section, also say how respondents were selected, since the interval only makes sense for a random sample. Our guide to the statistical treatment of data shows where this goes in a thesis.

Common mistakes with confidence intervals

Most mistakes come from reading more into the interval than it holds. Check a report against this list before it goes out.

  • Give the level, both limits and n with every interval, and the method if you used Wilson or a t value.
  • Recompute the interval for each subgroup with its own n: at 50%, a segment of 80 respondents has a margin of about ±11 points.
  • Do not say there is a 95% chance the true value is inside your interval.
  • Do not attach a margin of error to an opt-in or convenience sample as if it were random. The formula assumes random selection; see our guide to non-probability sampling.
  • Do not read overlapping intervals as "no difference". Check the interval of the difference.
  • Do not compute a mean interval for category codes such as 1 = email, 2 = phone, 3 = chat. Use shares and proportion intervals.
  • Do not treat a significant difference as an important one. With 5,000 respondents per group, 50% against 52% already gives p = .045. The interval of the difference shows how big the effect is.

How to get confidence intervals for your survey in SurveyNinja

The free calculators on SurveyNinja work without an account, so you can use them on results from any tool. With a survey in SurveyNinja the steps are short:

  1. Ask the question as a single-choice, scale or rating question. You can create a survey for free; sign-up asks only for an email and a password.
  2. Take the number of answers and the share for the option you care about from the results, or export responses to CSV, XLSX or SPSS, which works on every plan, including Free.
  3. For a percentage, enter the share and n in the confidence interval calculator and choose 90%, 95% or 99%.
  4. For a mean rating, get the mean and standard deviation of the exported column, then apply x̄ ± t × s / √n or CONFIDENCE.T.

For a segment, such as one plan or one region, filter the responses (filters are available from the Basic plan) or split the export in a spreadsheet, and compute a separate interval with that segment's n.

Frequently asked questions

What is a confidence interval in simple terms?

It is a range around a survey result that shows how precise the result is. If 62% of 400 respondents say yes, the 95% confidence interval is about 57% to 67%: the share among everyone you sampled from could plausibly be anywhere in that range. Larger samples give narrower intervals, and the interval covers only random sampling error.

What does a 95% confidence interval mean?

It means the method works about 95% of the time. If you repeated the survey with many new random samples and built an interval from each, about 95% of those intervals would contain the true population value. It does not mean there is a 95% probability that the true value lies inside the one interval you calculated.

How do you calculate a confidence interval for a percentage?

Use p ± 1.96 × √(p(1 − p)/n) for 95% confidence, with p as a decimal. For 248 yes answers out of 400, p = 0.62, the standard error is 0.0243 and the margin is 4.8 points, so the interval is 57.2% to 66.8%. For small samples or shares near 0% or 100%, use the Wilson interval instead.

What is the difference between a confidence interval and a margin of error?

The margin of error is the plus-or-minus part; the confidence interval is the full range it creates. A result of 62% with a margin of ±4.8 points gives an interval of 57.2% to 66.8%, so the margin is half the interval's width. The Wilson interval can be asymmetric, with different distances to each limit.

Why is my confidence interval so wide?

Usually because n is small. The margin shrinks with the square root of the sample size: at 50% it is ±9.8 points with 100 answers and ±4.9 with 400. Subgroups have smaller n than the total, so their intervals are wider. A 99% level and results near 50% also widen the interval, and for a mean, so does a large standard deviation.

Do overlapping confidence intervals mean there is no significant difference?

No. If two 95% intervals do not overlap, the difference is significant, but overlapping intervals can still hide a significant difference. In our example, 58% and 50% of 400 have overlapping intervals, yet the difference of 8 points has a 95% interval of 1.1 to 14.9 points and p = .023.

0