Free Online Statistics Tool

Sample Size Calculator

Find the sample size you need for a survey or a study. Use Cochran's formula, Slovin's (Yamane's) formula, or the formula for estimating a mean, and see every step.

Sample Size Calculator

Choose a method, enter your numbers and get your result instantly.

If you do not know the expected proportion, leave it empty. The calculator then uses 50%, which gives the largest, safest sample size.

Step-by-Step Solution

    What Is a Sample Size?

    The sample size is the number of people, items or measurements you collect for a survey or a study. If it is too small, your results can be far from the truth. If it is much larger than needed, you spend extra time and money without gaining much accuracy.

    A sample size formula connects four things: how precise you want to be (the margin of error), how sure you want to be (the confidence level), how much your data varies, and sometimes the size of the whole population.

    All the formulas on this page assume a simple random sample. If some people may not respond, divide the sample size by the response rate you expect. For example, with an expected response rate of 80%, divide by 0.8.

    Cochran's Formula for a Survey Percentage

    Cochran's formula finds the sample size needed to estimate a percentage, such as the share of people who say yes to a question.

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

    Here z is the value for your confidence level, p is the expected proportion as a decimal, and e is the margin of error as a decimal. The value of z is 1.6449 for 90% confidence, 1.96 for 95% and 2.5758 for 99%.

    When you do not know p, use 0.5. This makes p × (1 − p) as large as it can be, so the result is the largest sample size that could be needed. The answer is always rounded up to the next whole number.

    Confidence levelMargin of errorSample size (p = 50%)
    90%±10%68
    90%±5%271
    95%±10%97
    95%±5%385
    95%±3%1,068
    99%±10%166
    99%±5%664

    Finite Population Correction

    Cochran's first answer assumes a very large population. When the population is small, you can need fewer people, because your sample is a bigger share of the whole group. The corrected sample size is:

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

    Here n₀ is the sample size from Cochran's formula and N is the population size. The larger the population, the closer n is to n₀. Our calculator applies this correction when you enter a population size.

    Slovin's and Yamane's Formula

    Slovin's formula and Yamane's formula are two names for the same calculation. It is popular in school and thesis work because it needs only the population size and the margin of error.

    n = N ÷ ( 1 + N × e² )

    Here N is the population size and e is the margin of error as a decimal. The formula has no confidence level, so if you need to state one, use Cochran's formula instead. For the same population, the two methods give close but not identical answers.

    Sample Size for Estimating a Mean

    If you want to estimate an average, such as the mean score or the mean height, the sample size depends on how spread out the data is.

    n = ( z × σ ÷ E )²

    Here σ is the standard deviation, E is the margin of error in the same units as the data, and z is the value for your confidence level. If you do not know σ, you can use a value from a similar earlier study or from a small pilot sample. You can find a standard deviation with our Standard Deviation Calculator.

    Sample Size Calculator Examples

    Example 1: a survey of a large population

    95% confidence, margin of error 5%, expected proportion 50%

    n₀ = 1.96² × 0.5 × 0.5 ÷ 0.05² = 0.9604 ÷ 0.0025 = 384.16. Rounded up, you need 385 people.

    Example 2: the same survey in a population of 1,000

    n = 384.16 ÷ (1 + (384.16 − 1) ÷ 1000) = 384.16 ÷ 1.38316 ≈ 277.74. Rounded up, you need 278 people.

    Example 3: Slovin's formula

    N = 1,000, margin of error 5%

    n = 1000 ÷ (1 + 1000 × 0.05²) = 1000 ÷ 3.5 ≈ 285.71. Rounded up, you need 286 people.

    Example 4: estimating a mean

    σ = 15, margin of error 3, 95% confidence

    n = (1.96 × 15 ÷ 3)² = 9.8² = 96.04. Rounded up, you need 97 values. If you cut the margin of error to 1.5, you get (1.96 × 15 ÷ 1.5)² = 19.6² = 384.16, which needs 385 values.

    More Sample Size Examples

    These extra worked examples show how the margin of error, the confidence level and the expected proportion change the sample size, and how Slovin's formula compares with Cochran's formula for a small population. Remember that every answer is rounded up to the next whole number.

    Example 5: A tighter margin of error

    Find the sample size for 95% confidence, a margin of error of 3% and an expected proportion of 50%.

    Answer: you need 1,068 people.

    n₀ = 1.96² × 0.5 × 0.5 ÷ 0.03² = 0.9604 ÷ 0.0009 ≈ 1,067.11, which rounds up to 1,068. With a margin of error of 5% you needed only 385 people, so making the margin smaller from 5% to 3% needs almost three times as many.

    Example 6: A higher confidence level

    Find the sample size for 99% confidence, a margin of error of 5% and an expected proportion of 50%.

    Answer: you need 664 people.

    The z value for 99% confidence is 2.5758. Then n₀ = 2.5758² × 0.5 × 0.5 ÷ 0.05² = 1.65869 ÷ 0.0025 ≈ 663.48, which rounds up to 664. For 95% confidence the same margin needed 385 people, so asking to be more sure costs more people.

    Example 7: Using an expected proportion

    An earlier study found that about 20% of people do something. Find the sample size for 95% confidence and a margin of error of 5%, using 20% as the expected proportion.

    Answer: you need 246 people, instead of 385.

    n₀ = 1.96² × 0.2 × 0.8 ÷ 0.05² = 3.8416 × 0.16 ÷ 0.0025 = 0.614656 ÷ 0.0025 ≈ 245.86, which rounds up to 246. Using 50% would give 385. Only use a smaller expected proportion if you have good evidence for it, because if the true value is closer to 50%, your margin of error will be larger than planned.

    Example 8: A small population

    A school has 200 students. Find the sample size for a margin of error of 5% using Slovin's formula, and compare it with Cochran's formula at 95% confidence and p = 50%.

    Answer: Slovin's formula gives 134, and Cochran's formula with the finite correction gives 132.

    Slovin: n = 200 ÷ (1 + 200 × 0.05²) = 200 ÷ 1.5 ≈ 133.33, which rounds up to 134. Cochran: n₀ = 384.16, so n = 384.16 ÷ (1 + 383.16 ÷ 200) = 384.16 ÷ 2.9158 ≈ 131.75, which rounds up to 132. The two methods give close answers, and both show that for a small population you need to ask a large share of the group.

    Common mistakes when finding a sample size

    A common mistake is forgetting to round up, because rounding down gives a sample that is slightly too small. Another is entering the margin of error as a decimal in a calculator that expects a percentage, or the other way around. Also remember that these formulas assume a random sample, and that you may need extra people to allow for those who do not respond. Once you have your data, you can build an interval with our Confidence Interval Calculator.

    Created by Sajid Ali, SmartStatCalc · Last updated: 8 November 2026

    Found a mistake or have a suggestion? Contact us.

    How to Use Our Sample Size Calculator

    1. Choose the method: Cochran's formula, Slovin's formula or estimating a mean.
    2. Choose the confidence level, if the method uses one.
    3. Enter the margin of error and the other numbers for your method.
    4. Click the Calculate Sample Size button.
    5. Read the sample size and check the step-by-step solution.

    Click Reset at any time to clear everything and start again. To see how precisely a sample mean estimates the true mean, try the Standard Error Calculator.

    Why Use SmartStatCalc?

    SmartStatCalc is built to make everyday statistics quick and easy to understand. Instead of working through formulas and rounding by hand, you can enter your numbers and see a clear result right away.

    Free to UseFind a sample size online without an account or any payment.
    Three MethodsChoose Cochran, Slovin or Yamane, or the formula for a mean.
    Step-by-Step ResultsSee the formula, the numbers you used and the rounding.
    Works on Any DeviceUse it on your phone, tablet, or computer. Your numbers stay in your browser.

    Who Can Use a Sample Size Calculator?

    Students use it for thesis and survey projects, and teachers use it to explain how sampling works. Researchers and analysts use it to plan surveys, polls and experiments before they collect any data.

    Frequently Asked Questions

    What sample size should I use?

    It depends on your margin of error, your confidence level and how much your data varies. For a large population, 385 is a common answer for a 5% margin of error at 95% confidence when you use 50% as the expected proportion.

    Is Slovin's formula the same as Yamane's formula?

    Yes. They are two names for the same formula, n = N ÷ (1 + N × e²).

    Why is 50% used as the expected proportion?

    It makes the result as large as it can be, so it is the safest choice when you have no earlier estimate.

    Does the population size matter?

    Only a little when the population is large. It matters more when your sample would be a big share of a small population.

    What is the margin of error?

    It is how far your sample result might be from the true value. A margin of error of 5% means the true value is likely to be within 5 percentage points of your result.

    Can I use these formulas for a non-random sample?

    The formulas assume a simple random sample. If your sample is not random, the margin of error from these formulas may not be reliable.

    Should I add extra people for non-response?

    Yes. Divide the sample size by the response rate you expect. For example, with 385 needed and an 80% response rate, you would invite about 481 people.

    Is this Sample Size Calculator free?

    Yes. SmartStatCalc's Sample Size Calculator is free to use online.

    Contact SmartStatCalc

    Have a question, suggestion, or feedback about our calculators? We want to make SmartStatCalc more useful, accurate, and easier for everyone to use.

    If you spot a mistake or have an idea for another statistics tool, we would be happy to hear from you.

    Questions & FeedbackPlease use the Contact Us page on SmartStatCalc to get in touch with us.

    Cite this calculator

    If you use this calculator in your work, you can cite it like this:

    SmartStatCalc. (2026). Sample Size Calculator. https://smartstatcalc.com/sample-size-calculator/

    Scroll to Top