Sample Size Formula Explained (Cochran’s Formula, Step by Step)

TL;DR: Cochran’s formula is n₀ = z² × p × (1 − p) / e². Put in the z-score for your confidence level, your best guess at the proportion, and your margin of error, and it gives the sample size for a large population. For a population of 1,000 at 95% confidence and 5% margin of error, the formula gives 384.16, and the finite population correction brings it down to 278.

Most sample size calculators use the same equation under the hood, and it is worth knowing what it actually does. It is called Cochran’s formula, after the statistician William G. Cochran, who set it out in his 1977 book Sampling Techniques. It is the standard formula for working out how many responses you need when you are estimating a proportion — a share or percentage, such as the share of customers who are satisfied or the share of voters who support a candidate.

This guide explains the formula piece by piece and works through a complete example with real arithmetic you can check. Follow along with our free Sample Size Calculator.

What is Cochran’s formula?

Cochran’s formula answers one question: how large must a sample be for its estimate to fall within a chosen margin of error, at a chosen confidence level? It is written as:

n₀ = z² × p × (1 − p) / e²

The subscript zero in n₀ marks this as the sample size for an infinitely large population — the starting point before any adjustment for a real, finite population. There are four ingredients, and each one is a decision you make about your study.

SymbolMeaningHow you choose it
zZ-score for your confidence level1.96 for 95% confidence
pExpected proportion — your best guess at the share giving a particular answer0.5 if you do not know
eMargin of error as a decimal0.05 for a 5% margin of error
n₀Sample size for a very large populationThis is what you are solving for

Where does the formula come from?

The formula is a rearrangement of the margin of error for a proportion. For a sample proportion, the margin of error at a given confidence level is e = z × √(p × (1 − p) / n). That says the error depends on the z-score, on how spread out the answers are — p × (1 − p) is the variance of a yes/no answer — and on the sample size, n, sitting under a square root in the denominator.

Solving that equation for n gives n = z² × p × (1 − p) / e² — nothing else is hidden in it. That is why doubling the z-score quadruples the sample, and halving the margin of error quadruples it too, and why the sample size barely depends on the population at all: the population does not even appear in this version of the formula.

What each part of the formula means

The z-score, z, comes from the normal distribution and encodes your confidence level. The standard values are 1.645 for 90% confidence, 1.96 for 95% confidence and 2.576 for 99% confidence. A higher confidence level means a bigger z, and because z is squared, the sample size grows fast: moving from 95% to 99% confidence needs about 73% more responses.

It enters the formula as p × (1 − p), largest at p = 0.5 (0.25) and smaller at the extremes (0.1 × 0.9 = 0.09). That is why 0.5 is the safe default: it assumes the hardest case, a 50/50 split, and gives the largest sample size. If earlier research says only about 20% will say yes, you can use p = 0.2 — but only trust that smaller number if the earlier figure is solid.

The margin of error, e, is written as a decimal: 5% becomes 0.05, 3% becomes 0.03. It is the precision you demand. Because it is squared in the denominator, small changes in e have large effects — tightening the margin of error from 5% to 3% multiplies the sample size by (0.05 / 0.03)², which is about 2.78 times.

Worked example: a population of 1,000 at 95% confidence

Suppose you are surveying a town’s 1,000 households at 95% confidence with a 5% margin of error, and you have no prior guess, so p = 0.5. Work through the formula in steps.

  1. Square the z-score. For 95% confidence, z = 1.96, so z² = 1.96 × 1.96 = 3.8416.
  2. Work out p × (1 − p). With p = 0.5, this is 0.5 × 0.5 = 0.25.
  3. Multiply the top. 3.8416 × 0.25 = 0.9604.
  4. Square the margin of error. e = 0.05, so e² = 0.05 × 0.05 = 0.0025.
  5. Divide. n₀ = 0.9604 / 0.0025 = 384.16.

That 384.16 is the sample size for a very large population. But this population is only 1,000, so the next step is the finite population correction.

The finite population correction

Cochran’s formula assumes a population so large that sampling a few people makes no difference. When the population is small, or the sample is a large share of it, that assumption breaks down, and the finite population correction fixes it:

n = n₀ / (1 + (n₀ − 1) / N)

Here N is the population size and n₀ is the uncorrected sample size from Cochran’s formula. The correction shrinks the sample, and it shrinks it more the smaller the population is. Continuing the example with N = 1,000 and n₀ = 384.16:

  1. Subtract 1 from n₀. 384.16 − 1 = 383.16.
  2. Divide by the population. 383.16 / 1,000 = 0.38316.
  3. Add 1. 1 + 0.38316 = 1.38316.
  4. Divide n₀ by that number. 384.16 / 1.38316 = 277.74, which rounds up to 278 people.

So the survey needs 278 completed responses, not 384. The correction saved about 106 interviews — a real saving in time and cost. Always round the final answer up: 277 responses would fall just short of the precision you asked for.

How the correction changes with population size

The table below uses the same settings — 95% confidence, 5% margin of error, p = 0.5. The uncorrected figure, n₀, is 384.16 in every row.

Population (N)Corrected sample size (n)Share of the population
20013266%
50021844%
1,00027828%
5,0003577%
100,0003830.4%
Very large385Almost none

The pattern is the point: once the population passes a few thousand, the correction barely matters, and the sample size settles near 385. Below that, it matters a lot — for a population of 200, you need two-thirds of everyone. If the corrected sample is most of the population, surveying everyone is often simpler than sampling.

How the answer changes when you change the inputs

Changing any input moves the answer. Tightening the margin of error from 5% to 3% pushes the sample from 384 to 1,068; loosening it to 10% drops it to 97. Raising the confidence level from 95% to 99% pushes it from 384 to 664, while dropping to 90% brings it to 271. And changing the expected proportion from 0.5 to 0.2 drops it to 246, while p = 0.1 drops it to 139.

The lesson is that the margin of error is the most powerful lever you have: halving it quadruples the sample. That is why 5% is the usual compromise — it is precise enough for most decisions without demanding a sample that is hard to collect. If you want to see how the margin of error and the sample size trade off against each other, read the guide on sample size vs margin of error.

When to use Cochran’s formula — and when not to

Cochran’s formula fits when you are estimating a proportion from a simple random sample, when you can state a confidence level, and when the population is at least a few hundred. It is the standard choice for surveys, polls, customer research and class assignments that report a percentage with a margin of error.

It does not fit every study. Estimating a mean — an average income or test score — needs the sample size formula for a mean, which uses the population standard deviation instead of p. Stratified or clustered sampling needs a design effect adjustment. And if your sample is not random at all, no formula can make the result representative; the number it gives is not meaningful.

For a quick sample size when only the population and the margin of error are known, Slovin’s formula is a simpler shortcut — 286 for a population of 1,000 at 5% margin of error, against Cochran’s 278 — but it cannot state a confidence level. When the result will be reported or relied on, use Cochran’s formula.

Frequently Asked Questions

What is Cochran's sample size formula?

Cochran's formula is n0 = z² × p × (1 − p) / e². It gives the sample size for estimating a proportion, where z is the z-score for your confidence level, p is the expected proportion, and e is the margin of error as a decimal.

What is the finite population correction?

The finite population correction adjusts Cochran's result when the population is small or known. It is n = n0 / (1 + (n0 − 1) / N), where n0 is the uncorrected sample size and N is the population size. It shrinks the sample because you cannot sample more people than exist.

What sample size do I need for 1,000 people at 95% confidence and 5% margin of error?

278 people. Cochran's formula first gives n0 = 384.16, and the finite population correction for N = 1,000 brings that down to 277.74, which rounds up to 278.

Why is p = 0.5 used in the sample size formula?

The value p = 0.5 gives the largest possible sample size, because p × (1 − p) reaches its maximum of 0.25 at p = 0.5. Using it when you have no prior guess is the safe choice — it guarantees enough responses whatever the true proportion turns out to be.

What is the difference between Cochran's formula and Slovin's formula?

Cochran's formula lets you set a confidence level through the z-score and an expected proportion, while Slovin's formula (n = N / (1 + N × e²)) uses only the population size and the margin of error. Cochran's is the standard choice when you need to state a confidence level; Slovin's is a quicker, rougher shortcut.