Sample size calculator

Do you need calculate the sample size? Use our online calculator and you will be able to get the right sample size for the population you want to investigate.

To use the sample size calculator you only need to fill in four essential pieces of information: the size of the population, the percentage of deviation, the maximum percentage of error that you allow and the confidence level. If you don't know what these parameters are, read on to get a good understanding of how to calculate a sample size.

Data to calculate the sample size

Sample size calculator

In order to calculate the sample size a number of factors must be known we will tell you about below:

  • Margin of erroris defined as the range in which we want to find the data to be analyzed within the population. The margin of error usually represents a mean or a proportion. Note that if you reduce the margin of error, we have to increase the sample size for the result to be reliable. In turn, if we increase the sample size we can reduce the margin of error or increase the confidence level.
  • Confidence levelThis data represents the confidence that we have that the data we want is within the margin of error.
  • Populationpopulation: is the group of elements that share a common characteristic (for example, the inhabitants of the same city). The population can be finite or infinite. A finite population is one that is delimited and we know how many members are in it, while an infinite population is one that is delimited but we do not know how many members are in it.
  • Standard deviationif we do not know its value we will use a 50%.

With all these data, we can calculate the sample size from the formula we will see in the next point.

Formula for calculating a representative sample

This is the formula you should apply to calculate the sample size:

Formula for calculating the sample size


  • N the size of the population or universe
  • e is the margin of error
  • p is the proportion that we want to find and that corresponds to the value of the standard deviation that we saw in the previous section. If we do not know its value, we will use a 50%, i.e. 0.5 in the formula.
  • Z is a constant that depends on the confidence level and whose values are taken from the standard normal distribution table N(0,1). Here are the most commonly used Z values according to their confidence level:
Confidence levelValue of Z

If the population size is very large (more than 100,000 elements), the above formula can be simplified and would look like this:

Formula for calculating the sample size in a very large population

Solved example to calculate sample size

We are going to see a exercise solved in which we are asked to calculate the sample size for a city with a population of 80,000 inhabitants and we want to know the percentage of them living in rented accommodation, with a margin of error of 5% and a confidence level of 95% (Z = 1.64)

Since the population size is less than 100,000, we will use the full formula to calculate the sample size:

n = [80,000 x 1.642 x 0,5 x (1 - 0,5)] / [(80.000 - 1) x 0,52 + 1,642 x 0,5 x (1 - 0,5)] = 383


2 thoughts on “Calculadora de tamaño muestral”

    • Hello Ulises,

      Thank you very much for taking the time to leave us this comment. We are glad you liked it.


Leave a Comment

Information on data protection

  • Responsible: Ignacio Cuesta
  • Purpose of processing: Spam control, comment management, etc.
  • Legitimation: Your consent
  • Communication of data: Data will not be communicated to third parties except by legal obligation.
  • Rights: Access, rectification, portability, forgetfulness.
  • Contact us:
  • Additional information: More information at our privacy policy.