Calculate the sample size for a proportion and a mean, with finite population, design effect and response rate, the margin of error for a given n and the confidence interval, with the formula and the values filled in.
The sample size your margin of error requires, with the math in view.
To estimate a proportion, the sample size is n₀ = z² · p · (1 − p) / E², where z is the critical value of the confidence level (1.96 for 95%), p the expected proportion and E the margin of error, all as fractions. With 95% confidence, a 5% margin and p = 50% (the worst case, which gives the largest sample) the result is 384.15, rounded up: 385 respondents. At 99% confidence it is 664; with a 3% margin, 1,068; with a 10% margin, 97. If the population is small and known, Cochran's finite population correction, n = n₀ / (1 + (n₀ − 1) / N), lowers the number: for N = 1,000 it drops to 278, for N = 500 to 218 and for N = 10,000 to 370; above roughly 100,000 the effect is negligible (383). To estimate a mean, n₀ = (z · σ / E)², as in the NIST/SEMATECH e-Handbook: with σ = 15 and a margin of 2, that is 217 observations; if σ was estimated, Student's t requires the smallest sample whose real margin fits the target, here 219. Real surveys adjust two more things: the design effect (deff), which multiplies n when sampling by clusters, and the response rate, which sets how many to invite (385 respondents at a 30% response rate need 1,284 invitations). In the other direction, the margin of error for a given n is E = z · √(p(1 − p) / n): with 1,000 respondents it is ±3.1 percentage points and with 2,000, ±2.2. For a proportion's confidence interval, the tool shows four methods side by side; the Wald interval, taught in many textbooks, fails with small samples or extreme proportions, and Wilson or Clopper-Pearson are more reliable. A mean's interval uses Student's t with n − 1 degrees of freedom. The comparison tab computes the size per group to detect a difference between two means or two proportions at the desired power, using the normal approximation. All formulas assume probability samples; with convenience samples, the margin of error does not have its usual statistical meaning.
How to use
Pick the calculation type, then enter the confidence level and the margin of error.
Under Size: proportion, enter the confidence (95% is the default), the margin of error and, if you want, the total population; the result gives the minimum n, how many to invite and the formula with the values.
Under Size: mean, enter the margin in the variable's unit and the standard deviation; pick normal (σ known) or Student t (σ estimated). Under Margin of error, go the other way from n.
Under Confidence interval, enter successes and total (or mean, SD and n, or paste the data) and compare Wald, Wilson, Agresti-Coull and Clopper-Pearson. Under Compare groups, compute the n per group from the power.
Embed
Use this tool on your site
Paste the code into your HTML and the tool shows up on your page, without J-Kit's navigation and ads. It still runs in the browser of whoever visits your site.
<iframesrc="https://jkit.tools/embed/en-US/sample-size-calculator"width="100%"height="600"style="border:0"loading="lazy"referrerpolicy="no-referrer-when-downgrade"title="Sample Size and Margin of Error Calculator"></iframe><p style="font-size:12px;margin:6px 0 0">Tool by <a href="https://jkit.tools/en/tools/sample-size-calculator">J-Kit</a></p>
Cite
Cite or link to this tool
Using it in a paper, class or post? Copy the link or a ready-made reference. The access date is today's.
<a href="https://jkit.tools/en/tools/sample-size-calculator">Sample Size and Margin of Error Calculator</a>
References
Sources and references for this tool
These references help contextualize formulas, standards, APIs and limitations used on this page. They do not replace professional validation when a result has legal, financial, medical or operational impact.
For a proportion, use n₀ = z² · p · (1 − p) / E². At 95% confidence (z = 1.96), a 5% margin and p = 50%, n₀ = 384.15, so 385 people. If the population is finite, apply n = n₀ / (1 + (n₀ − 1) / N). Then multiply by the design effect, if any, and divide by the expected response rate to learn how many to invite.