ForHosting KIT · Developer Utilities

Sample Size for a Proportion Calculator

This sample size for a proportion calculator determines the minimum number of independent observations needed to estimate a population proportion at a chosen confidence level and margin of error.

● BetaFree · in your browser
Use it from WebAPIEmailTelegramApp soon

Enter the anticipated proportion as a decimal, the largest acceptable margin of error, and a two-sided confidence level. The result uses the standard normal approximation and always rounds upward, because a fractional participant or observation cannot satisfy the target precision. It is useful for planning surveys, polls, audits, experiments, and quality checks before collection begins.

Choose inputs that match the study question

Start by expressing every input as a decimal. A five-percentage-point margin is entered as 0.05, and a 95 percent confidence level is entered as 0.95. The estimated proportion is your best advance estimate of the share expected to have the characteristic of interest. It may come from a pilot study, a previous survey, operational records, or a closely comparable population. If no credible estimate exists, using 0.5 is the conservative conventional choice because the product p multiplied by one minus p is largest at 0.5. That choice therefore produces the largest sample under this formula for a fixed margin and confidence. Define the outcome before choosing the estimate: the proportion of customers who renew is not interchangeable with the proportion who recommend a product. Inputs should describe one binary outcome and one intended population. The calculator expects independent observations and a margin measured on the proportion scale, not a relative percentage of the expected result.

Understand the calculation and upward rounding

The calculator first converts the two-sided confidence level into its standard normal critical value, commonly called the z score. It then evaluates z squared times the estimated proportion times one minus that proportion, divided by the squared margin of error. This is the familiar planning formula for a proportion under the normal approximation. The computed quantity is rounded up to the next whole observation. Upward rounding matters: rounding to the nearest integer could leave the planned study just below its stated precision. The returned z score is shown for transparency, while the sample size is calculated from the unrounded internal value. The result is a minimum under the assumptions of the formula, not a promise that every realized sample will have exactly that error. Actual uncertainty depends on the observed proportion and the sampling process. The calculation also does not add allowances for nonresponse, invalid records, attrition, clustering, weighting, or repeated measurements; those design effects belong in the study plan after the statistical minimum is found.

Interpret the result and account for study design

Treat the returned sample size as the number of usable, independent responses or observations required for analysis. If only 80 percent of invited participants are expected to respond, divide the required usable count by 0.8 and round up to estimate how many invitations to send. Clustered samples, such as students within schools or patients within clinics, usually need an additional design-effect adjustment because observations inside a cluster are correlated. A known finite population can sometimes justify a finite population correction, but this calculator intentionally reports the standard large-population result so its assumptions remain clear and portable. Extremely rare or extremely common outcomes may also require methods tailored to interval coverage rather than this normal planning approximation. Before collecting data, document the chosen margin, confidence, anticipated proportion, expected response rate, and any design effect. That record makes the result reproducible and prevents a later change in assumptions from appearing to be a change in arithmetic. For automated planning, the API charge is $0.002 per request and returns the same deterministic calculation.

Plan a customer survey

Estimate how many completed responses are needed to measure the share of customers who support a proposed change.

Design a quality audit

Set the number of independently inspected items needed to estimate a defect proportion at a stated precision.

Prepare a public opinion poll

Calculate the statistical minimum before adding expected nonresponse and sampling-design adjustments.

What formula does the calculator use?

It uses the standard large-population normal approximation: the squared z critical value multiplied by p(1-p), divided by the squared margin of error, then rounded upward.

What proportion should I use when I have no prior estimate?

Use 0.5 when no defensible estimate exists. It maximizes p(1-p) and gives the most conservative sample size for the selected margin and confidence.

Should I enter percentages or decimals?

Enter decimals. For example, enter a five-percentage-point margin as 0.05 and a 95 percent confidence level as 0.95.

Does the result include nonresponse or dropout?

No. The result is the required number of usable independent observations. Increase recruitment separately for expected nonresponse, exclusions, or attrition.

Does this calculator apply a finite population correction?

No. It returns the standard large-population calculation. Apply a finite population correction separately when the sample is a substantial share of a known population.

Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.

POSThttps://api.kit.forhosting.com/stat/sample-size-proportion

Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/stat/sample-size-proportion \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"margin":0.05,"estimated_proportion":0.5,"confidence":0.95}'
{
  "margin": 0.05,
  "estimated_proportion": 0.5,
  "confidence": 0.95
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "stat.sample_size_proportion",
  "status": "queued",
  "_links": {
    "result": "/tasks/tsk_…/result"
  }
}

The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Read the full KIT documentation →