# How to Compute the Required Sample Size

Sample Size Calculator

Enter a percent between 0 and 100 for the desired margin of error. Enter the population size N, or leave blank if the total population is large.

Desired Margin of Error = %
N =

In polling, the margin of error represents the approximate amount of variance you can expect in poll results if you repeat the survey under the same conditions. For samples drawn from extremely large populations (more than 1,000,000), or samples that are less than 5% of the total population, the margin of error depends solely on the sample size. For samples drawn from small populations, or samples that are more than 5% of the population, the margin of error must be adjusted slightly.

For any desired margin of error, you can calculate the sample size needed to attain that margin of error. The sample size calculator on the left will return the necessary sample size for either a large or small total population. You can also apply the formulas described below.

## Large Population

If you have a sample of size n that is drawn from a very large population (N larger than 1,000,000), then the maximum margin of error M is given by the equation

M = (0.98)sqrt[1/n].

In this equation, M is expressed as a decimal, that is, 3% is 0.03. For the calculator above, you do not need to convert percents to decimals, as it will do the math for you. With algebra, you can rearrange the above equation to solve for n:

n = (0.98/M)2.

Example: Suppose you want to conduct a survey that has a maximum margin of error of 2%. If we set M = 0.02, then we get

n = (0.98/0.02)2 = 492 = 2401.

So you must collect data from at least 2,401 people in order to get a margin of error 2%.

## Small Population

When the total population for a survey is much smaller, or the sample size is more than 5% of the total population, the maximum margin of error is

M = (0.98)sqrt[1/n]*sqrt[(N-n)/(N-1)]
= (0.98)sqrt[(N-n)/(Nn-n)]

Using algebra as before, we can rearrange this equation to isolate n:

n = N/[1 + (N-1)(M/0.98)2].

Example: You are conducting a yes/no survey about uniforms at a high school. The school has 1,000 students and you need a margin of error of 3%. Using N = 1000 and M = 0.03, we have

n = 1000/[1 + 999(0.03/0.98)2]
= 1000/1.936
= 517

So you must collect survey results from at least 517 students to attain a margin of error of 3% or better.