Bookmarks    
nPr and nCr    
Random Number    
SD Calculator    
Sample Size    
Percent Error    
Density    
Molarity    
Molar Mass    
Ohm's Law    
Watts to Amps    
Voltage Drop    
Long Division    
Mixed Numbers    
Rounding    
Nth Root    
Exponents    
Half-Life    
Polar Form    
De Moivre    
3D Distance    
Point to Line    
Cross Product    
Determinant    
Sin Cos Tan    
Triangle Area    
Scale Factor    
Sector Area    
Ellipse Area    
Cube Volume    
Box Volume    
Sphere Volume    
Cone Volume    
Pipe Volume    
Time Duration    
Time Card    
Present Value    
Future Value    
Churn Rate    
A/B Test Calc    
SEO Traffic    
Ideal Weight    
Fat Intake    
Child Height    
Golf Handicap    
Heat Index    
Wind Chill    
Dew Point    
Download Time    
kWh to Cost    
AC Size (BTU)    
Heating Costs    
LED Savings    
Trip Gas Cost    
Tire Size    
Solar Output    
Solar Payback    
Battery Size    
Wall Area    
Gravel Needed    
Mortar Mix    
Slope Grade    
Curtain Size    
Soil Needed    
Sod Needed    
Ramp Length    
Blind Size    
Drain Slope    
Board Feet    
Heat Loss    
Furniture Fit    
Moving Boxes    
Plywood Cuts    
Shelf Sag    
   Add
Probability and random number calculators
Independent Events
Independent Events
Two Events Solver
Two Events Solver
Repeated Trials
Repeated Trials
Bayes' Theorem
Bayes' Theorem
Expected Value
Expected Value
Binomial Distribution
Binomial Distribution
nPr and nCr
nPr and nCr
Circular Permutation
Circular Permutation
With Repetition
With Repetition
Random Number
Random Number
Averages and statistics calculators
Average Calculator
Average Calculator
Mean Median Mode
Mean Median Mode
SD Calculator
SD Calculator
Quartiles & IQR
Quartiles & IQR
Frequency Table
Frequency Table
Correlation (r)
Correlation (r)
Normal Probability
Normal Probability
Z-Score Calculator
Z-Score Calculator
Confidence Interval
Confidence Interval
Sample Size
Sample Size
Mark & Recapture
Mark & Recapture
P-Value Calculator
P-Value Calculator
Percentage and ratio calculators
Percentage Calc
Percentage Calc
Percent Change
Percent Change
Percent Difference
Percent Difference
Percent Error
Percent Error
Ratio Calculator
Ratio Calculator
Discount Calculator
Discount Calculator
Sales Tax Calculator
Sales Tax Calculator
Margin Calculator
Margin Calculator
Speed calculators
Speed Calculator
Speed Calculator
Density and concentration calculators
Density
Density
Molarity
Molarity
Molar Mass
Molar Mass
Physics and electricity calculators
Ohm's Law
Ohm's Law
Watts to Amps
Watts to Amps
Resistor Colors
Resistor Colors
Voltage Drop
Voltage Drop
Unit conversion calculators
Weight Converter
Weight Converter
Shoe Size Converter
Shoe Size Converter
Integer and signed number calculators
Long Division
Long Division
LCM Calculator
LCM Calculator
GCF Calculator
GCF Calculator
Integer Calculator
Integer Calculator
Prime Factorization
Prime Factorization
Diophantine Solver
Diophantine Solver
Modulo Calculator
Modulo Calculator
Factor Calculator
Factor Calculator
Roman Numerals
Roman Numerals
Fraction, decimal and rounding calculators
Fraction Calculator
Fraction Calculator
Mixed Numbers
Mixed Numbers
Simplify Fractions
Simplify Fractions
Fraction to Decimal
Fraction to Decimal
Decimal to Fraction
Decimal to Fraction
Rounding
Rounding
Equation and inequality calculators
Linear Equation
Linear Equation
Linear Systems
Linear Systems
Quadratic Formula
Quadratic Formula
Absolute Value
Absolute Value
Quadratic Inequality
Quadratic Inequality
Polynomial calculators
Binomial Theorem
Binomial Theorem
Square root and nth root calculators
Simplify Radicals
Simplify Radicals
Nth Root
Nth Root
Exponent and logarithm calculators
Exponents
Exponents
Log Calculator
Log Calculator
Number of Digits
Number of Digits
Scientific Notation
Scientific Notation
Sci. Notation Math
Sci. Notation Math
Half-Life
Half-Life
Complex number calculators
Complex Numbers
Complex Numbers
Polar Form
Polar Form
De Moivre
De Moivre
Function and graph calculators
Slope Calculator
Slope Calculator
Linear Function
Linear Function
Direct & Inverse Variation
Direct & Inverse Variation
y = ax² Calculator
y = ax² Calculator
Distance Formula
Distance Formula
3D Distance
3D Distance
Section Formula
Section Formula
Point to Line
Point to Line
Lat/Long Distance
Lat/Long Distance
Complete the Square
Complete the Square
Circle Equation
Circle Equation
Conic Sections
Conic Sections
Polar Coordinates
Polar Coordinates
Sequence calculators
Arithmetic Sequence
Arithmetic Sequence
Geometric Sequence
Geometric Sequence
Fibonacci Sequence
Fibonacci Sequence
Recurrence Relation
Recurrence Relation
Vector calculators
Vector Calculator
Vector Calculator
Cross Product
Cross Product
Matrix calculators
Matrix Calculator
Matrix Calculator
Determinant
Determinant
Inverse Matrix
Inverse Matrix
Plane geometry calculators
Sin Cos Tan
Sin Cos Tan
Degrees ⇔ Radians
Degrees ⇔ Radians
a sin θ + b cos θ
a sin θ + b cos θ
Triangle Solver
Triangle Solver
Triangle Area
Triangle Area
Right Triangle
Right Triangle
Pythagorean Theorem
Pythagorean Theorem
Polygon Angles
Polygon Angles
Scale Factor
Scale Factor
Parallel Lines
Parallel Lines
Rectangle Area
Rectangle Area
Parallelogram Area
Parallelogram Area
Trapezoid Area
Trapezoid Area
Circle Calculator
Circle Calculator
Sector Area
Sector Area
Inscribed Angle
Inscribed Angle
Ellipse Area
Ellipse Area
Solid geometry calculators
Cube Volume
Cube Volume
Cube Surface Area
Cube Surface Area
Box Volume
Box Volume
Box Surface Area
Box Surface Area
Cylinder Volume
Cylinder Volume
Cylinder Surface
Cylinder Surface
Sphere Volume
Sphere Volume
Sphere Surface
Sphere Surface
Spherical Cap Volume
Spherical Cap Volume
Cap Surface Area
Cap Surface Area
Ellipsoid Volume
Ellipsoid Volume
Ellipsoid Surface
Ellipsoid Surface
Pyramid Volume
Pyramid Volume
Pyramid Surface
Pyramid Surface
Cone Volume
Cone Volume
Cone Surface Area
Cone Surface Area
Frustum Volume
Frustum Volume
Frustum Surface Area
Frustum Surface Area
Pipe Volume
Pipe Volume
Capsule Volume
Capsule Volume
Capsule Surface Area
Capsule Surface Area
Date and time calculators
Age Calculator
Age Calculator
Days Between Dates
Days Between Dates
Date Calculator
Date Calculator
Hours From Now
Hours From Now
Day of the Week
Day of the Week
Time Calculator
Time Calculator
Time Zone Converter
Time Zone Converter
Hours Calculator
Hours Calculator
Time Duration
Time Duration
Time Card
Time Card
Finance and economics calculators
Compound Interest
Compound Interest
Simple Interest
Simple Interest
Interest Calculator
Interest Calculator
TVM Calculator
TVM Calculator
Present Value
Present Value
Future Value
Future Value
ROI Calculator
ROI Calculator
IRR Calculator
IRR Calculator
Payback Period
Payback Period
Average Return
Average Return
GDP Calculator
GDP Calculator
Web marketing and ad metric calculators
CTR Calculator
CTR Calculator
Conversion Rate
Conversion Rate
CPC, CPM & CPA
CPC, CPM & CPA
ROAS Calculator
ROAS Calculator
Break-Even CPA
Break-Even CPA
LTV Calculator
LTV Calculator
CAC Calculator
CAC Calculator
Churn Rate
Churn Rate
A/B Test Calc
A/B Test Calc
A/B Sample Size
A/B Sample Size
SEO Traffic
SEO Traffic
Break-Even Point
Break-Even Point
Markup vs. Margin
Markup vs. Margin
CAGR Calculator
CAGR Calculator
Health and fitness calculators
BMI Calculator
BMI Calculator
Sleep Calculator
Sleep Calculator
Calorie Calculator
Calorie Calculator
BMR Calculator
BMR Calculator
TDEE Calculator
TDEE Calculator
Ideal Weight
Ideal Weight
Body Fat Calculator
Body Fat Calculator
Lean Body Mass
Lean Body Mass
Calories Burned
Calories Burned
Protein Intake
Protein Intake
Macro Calculator
Macro Calculator
Carb Calculator
Carb Calculator
Fat Intake
Fat Intake
Child Height
Child Height
Sports calculators
Golf Handicap
Golf Handicap
Pace Calculator
Pace Calculator
1RM Calculator
1RM Calculator
Target Heart Rate
Target Heart Rate
Weather calculators
Heat Index
Heat Index
Wind Chill
Wind Chill
Dew Point
Dew Point
Computer calculators
Base Converter
Base Converter
Subnet Calculator
Subnet Calculator
Download Time
Download Time
Household energy and budget calculators
Electricity Cost
Electricity Cost
kWh to Cost
kWh to Cost
Yearly kWh to Cost
Yearly kWh to Cost
AC Size (BTU)
AC Size (BTU)
AC Running Cost
AC Running Cost
Heating Costs
Heating Costs
Gas vs Electric
Gas vs Electric
LED Savings
LED Savings
Salary Calculator
Salary Calculator
Budget Calculator
Budget Calculator
Car calculators
Trip Gas Cost
Trip Gas Cost
EV Charging Cost
EV Charging Cost
EV vs Gas Cost
EV vs Gas Cost
MPG Calculator
MPG Calculator
Tire Size
Tire Size
Solar power and battery calculators
Solar Output
Solar Output
Solar Panel Count
Solar Panel Count
Solar Payback
Solar Payback
Battery Size
Battery Size
Home and DIY calculators
Tile Calculator
Tile Calculator
Stair Calculator
Stair Calculator
Concrete Volume
Concrete Volume
Wall Area
Wall Area
Wallpaper Rolls
Wallpaper Rolls
Paint Calculator
Paint Calculator
Flooring Needed
Flooring Needed
Exterior Walls
Exterior Walls
Gravel Needed
Gravel Needed
Mortar Mix
Mortar Mix
Slope Grade
Slope Grade
Lumber Cut List
Lumber Cut List
Lot Coverage/FAR
Lot Coverage/FAR
Sheet Vinyl Roll
Sheet Vinyl Roll
Insulation Needed
Insulation Needed
Curtain Size
Curtain Size
TV Size & Distance
TV Size & Distance
Soil Needed
Soil Needed
Sod Needed
Sod Needed
Block Calculator
Block Calculator
Brick Calculator
Brick Calculator
Deck Materials
Deck Materials
Ramp Length
Ramp Length
Pilot Hole Size
Pilot Hole Size
Room Ventilation
Room Ventilation
Paint Thinning
Paint Thinning
Baseboard & Trim
Baseboard & Trim
Blind Size
Blind Size
Picture Hanging
Picture Hanging
Drain Slope
Drain Slope
Screw Calculator
Screw Calculator
Board Feet
Board Feet
Fence Calculator
Fence Calculator
Wood Shrinkage
Wood Shrinkage
Caulk Calculator
Caulk Calculator
Heat Loss
Heat Loss
Furniture Fit
Furniture Fit
Moving Boxes
Moving Boxes
Storage Capacity
Storage Capacity
Plywood Cuts
Plywood Cuts
Shelf Sag
Shelf Sag

Sample Size Calculator (Surveys and Margin of Error)

There are two ways to use this calculator. ① Enter the confidence level, proportion and margin of error to find the sample size you need. ② Enter the confidence level, proportion and sample size to find the margin of error. Enter the population size only if you know it.

Enter all values as percentages (for example, "95" for a 95% confidence level and "5" for a ±5% margin of error). Fill in only one of "margin of error" and "sample size", depending on what you want to find.
Result
Enter the confidence level and other values in the fields on the left and press "Calculate". The result will appear here.

What you can do on this page

  • "How many people do I need to survey for a 95% confidence level and a ±5% margin of error?" Get the sample size your survey needs on the spot
  • The other way around, "How accurate, plus or minus, is a survey of 1,000 people?" Find the margin of error on the same page
  • If you know the size of the population (500 employees, 1,000 members, and so on), the finite population correction narrows it down to the number you really need
  • A plain-language explanation of the formulas and copy-and-paste formulas for Excel, Google Sheets and Python are all on this page
This calculation assumes that respondents are chosen from the population at random, and that the survey measures a proportion (%), such as "yes" or "no" answers. Planning a survey that estimates a mean (such as average income) needs a different formula that uses the standard deviation.

What is this calculation used for?

Understanding the "±3 points" in polls and election coverage

National polls in the news usually survey about 1,000 to 2,000 randomly chosen people out of more than 200 million adults. At a 95% confidence level, a ±3% margin of error and a 50% proportion, the required sample size is \(1.96^2 \times 0.25 \div 0.03^2 \approx 1067.1\) (about 1,068 people). This formula answers the question, "Can about 1,000 people really tell us what hundreds of millions think?"
The other way around, you can see that if "45% versus 47% approval" is within a ±3-point margin of error, you cannot say for sure that there is a statistical difference.

Planning customer and employee satisfaction surveys (business)

"How many of our 1,000 members do we need to ask?" is a classic case for the finite population correction. At a 95% confidence level, a ±5% margin of error and a 50% proportion, the value before correction, 384.16, drops to \(384.16 \div (1 + 383.16 \div 1000) \approx 277.7\) (278 people after rounding up).
If you decide in advance how many responses are enough for the precision you need, before sending reminder after reminder to everyone, you can balance the cost and the precision of the survey with numbers.

Sample inspections in manufacturing (quality control)

This formula is also used to estimate the defect rate of mass-produced parts without inspecting every one. If past records suggest a defect rate of about 10%, a 90% confidence level and a ±4% margin of error give \(1.65^2 \times 0.1 \times 0.9 \div 0.04^2 \approx 153.1\), so a sample of about 154 parts is enough.
The example also shows that the farther the proportion is from 50%, the smaller the spread \(\hat{p}(1-\hat{p})\), and the fewer items you need.

Planning the number of participants in medical and epidemiological studies

In an epidemiological study of "the share of people in an area who have this condition", the study plan must state how many participants are needed. If earlier studies suggest a prevalence of about 20%, a 95% confidence level and a ±3% margin of error give \(1.96^2 \times 0.2 \times 0.8 \div 0.03^2 \approx 683.0\), about 683 people.
Real clinical research also uses more precise methods that fit the study design (such as power analysis). This formula is the basic form they start from.

TV ratings come from a sample of homes - how big is the error?

TV ratings are estimated from a panel of sample households, not from every home. As a simplified example (real ratings methods are more complex), take a panel of 2,700 households and a show watched in 10% of them. At a 95% confidence level, the margin of error is \(1.96 \times \sqrt{0.1 \times 0.9 \div 2700} \approx 0.0113\) (about ±1.1%).
You can then see that "the gap between a 9.5% and a 10.5% rating may be within the margin of error", and read the numbers in the news one step deeper.

Formula

Required sample size (when the population is very large)
Standard notation (the usual math form)
\(n_0\) \(=\) \(z^2\) \(\times\) \(\hat{p}\) \(\times\) \((1-\hat{p})\) \(\div\) \(\varepsilon^2\)
In words (symbols replaced with words)
⑤ \(n_0\): calculated value \(=\) ① z-score \(z\) squared \(\times\) ② \(\hat{p}\): expected proportion \(\times\) ③ the rest, \((1-\hat{p})\) \(\div\) ④ margin of error \(\varepsilon\) squared
The formula in words
① Take the square of the z-score \(z\) set by the confidence level
② multiply it by the \(\hat{p}\): expected proportion
③ and by the rest of the proportion, \((1-\hat{p})\)
④ divide by the square of the margin of error \(\varepsilon\)
⑤ and you get the calculated required sample size \(n_0\)
Quick example
With a 95% confidence level (z = 1.96), a proportion of 50% (0.5) and a margin of error of ±5% (0.05), the sample size you need is
\(n_0\): calculated value \(=\) 1.96 squared (3.8416) \(\times\) proportion (0.5) \(\times\) rest (1 − 0.5 = 0.5) \(\div\) 0.05 squared (0.0025)
\(3.8416 \times 0.5 \times 0.5 \div 0.0025 = 3.8416 \times 0.25 \div 0.0025 = 384.16\)
Key idea
Round the result up to get a number of people (384.16 → 385 people). If you rounded down, the margin of error would end up slightly larger than your target. If you have no idea of the proportion in advance, enter 50%. The spread \(\hat{p}(1-\hat{p})\) is largest when \(\hat{p}\) is 50%, so this gives the largest (safest) estimate of the number of people. The usual z-scores for each confidence level are 80% → 1.28, 85% → 1.44, 90% → 1.65, 95% → 1.96, 98% → 2.33 and 99% → 2.58 (the calculator on this page also uses these customary rounded values; statistics textbooks sometimes give 90% → 1.645 and 99% → 2.576).
Finite population correction for the sample size (when you know the population size \(N\))
Standard notation (the usual math form)
\(n\) \(=\) \(n_0\) \(\div\) \((\) \(1\) \(+\) \((n_0 - 1)\) \(\div\) \(N\) \()\)
In words (symbols replaced with words)
⑤ \(n\): corrected value \(=\) ④ \(n_0\): value before correction \(\div\) \((\) ③ \(1\) \(+\) ① value before correction minus 1, \((n_0 - 1)\) \(\div\) ② \(N\): population size \()\)
The formula in words
① Take the value before correction minus 1, \((n_0-1)\)
② divide it by the \(N\): population size
③ and add \(1\)
④ Divide the \(n_0\): value before correction by that number
⑤ and you get the corrected required sample size \(n\)
Quick example
If the value before correction is 384.16 (95% confidence level, 50% proportion, ±5% margin of error) and the population is 500 people, then
corrected value \(=\) value before correction (384.16) \(\div\) \((\) 1 \(+\) 384.16 − 1 = 383.16 \(\div\) population (500 people) \()\)
\(384.16 \div \left( 1 + \dfrac{383.16}{500} \right) = 384.16 \div 1.76632 \approx 217.49\)
Key idea
When the population is small, this correction cuts the number of people you need a lot (in this example, 385 people → 218 after rounding up). If you can study a large share of the population directly, the result is that much more certain. The divisor "\(1 + (n_0 - 1) \div N\)" shows how strong the correction is. If the population \(N\) is much larger than the calculated value \(n_0\), \((n_0 - 1) \div N\) is almost 0, so the divisor is almost 1 (dividing changes nothing, the same as no correction). The smaller the population, the larger the divisor gets above 1, and the fewer people you need. The "1" is the baseline of "divide by 1 (leave it as is) when there is no correction". On the other hand, if the population is much larger than the calculated value, the correction hardly changes anything, so you can leave "population size" in the calculator blank (no correction). As in the first formula, round up (217.49 → 218 people).
Margin of error (when the population is very large)
Standard notation (the usual math form)
\(\varepsilon\) \(=\) \(z\) \(\times\) \(\sqrt{\dfrac{\hat{p}(1-\hat{p})}{n}}\)
In words (symbols replaced with words)
③ \(\varepsilon\): margin of error \(=\) ① \(z\): z-score \(\times\) ② square root of \(\dfrac{\text{spread of the proportion }\hat{p}(1-\hat{p})}{\text{sample size }n}\)
The formula in words
① Take the z-score \(z\) set by the confidence level
② multiply it by the square root of \(\dfrac{\text{spread of the proportion }\hat{p}(1-\hat{p})}{\text{sample size }n}\)
③ and you get the \(\varepsilon\): margin of error
Quick example
At a 95% confidence level (z = 1.96), for a survey where 60% of 100 people answered "yes", the margin of error is
\(\varepsilon\): margin of error \(=\) z-score (1.96) \(\times\) square root of "0.6 × 0.4 ÷ 100"
\(1.96 \times \sqrt{0.6 \times 0.4 \div 100} = 1.96 \times \sqrt{0.0024} \approx 1.96 \times 0.0490 \approx 0.0960\ \ (9.60\%)\)
Key idea
For \(\hat{p}\) in the spread \(\hat{p}(1-\hat{p})\), use the proportion you actually got in the survey (the sample proportion). The sample size \(n\) is in the denominator inside the square root, so to cut the error in half you need 4 times the sample, and to cut it to a third you need 9 times. "Adding more sample helps only slowly" is an important property of this formula.
Finite population correction for the margin of error (when you know the population size \(N\))
Standard notation (the usual math form)
\(\varepsilon\) \(=\) \(\varepsilon_0\) \(\times\) \(\sqrt{\dfrac{N-n}{N-1}}\)
In words (symbols replaced with words)
③ \(\varepsilon\): corrected margin of error \(=\) ① \(\varepsilon_0\): margin of error before correction \(\times\) ② square root of the correction factor \(\dfrac{\text{rest of the population }(N-n)}{\text{population size minus 1 }(N-1)}\)
The formula in words
① Take the margin of error before correction, \(\varepsilon_0\) (from the third formula)
② multiply it by the square root of the correction factor \(\dfrac{\text{rest of the population }(N-n)}{\text{population size minus 1 }(N-1)}\)
③ and you get the \(\varepsilon\): corrected margin of error
Quick example
If you survey 200 of a population of 1,000 people and the margin of error before correction is 6.35%, the corrected margin of error is
\(\varepsilon\): corrected margin of error \(=\) margin of error before correction (6.35%) \(\times\) square root of "800 ÷ 999"
\(6.35 \times \sqrt{\dfrac{1000 - 200}{1000 - 1}} = 6.35 \times \sqrt{0.8008} \approx 6.35 \times 0.8949 \approx 5.68\,(\%)\)
Key idea
If you study a large part of the population, the result is that much more certain. The correction factor shows this: as the sample size \(n\) gets close to the population size \(N\), it gets close to 0 (a census that covers everyone has zero error), and when \(N\) is very large it is almost 1 (the same as no correction). You can multiply the margin of error as a percentage (the correction factor is a number with no units that is 1 or less).
The required sample size is "z-score squared × spread of the proportion ÷ margin of error squared", rounded up. The margin of error is "z-score × √(spread ÷ sample size)". When you know the population size, the finite population correction lowers the number of people you need (and makes the error smaller).

Symbols and terms

Symbols

\(n\) en The sample size. For a survey, it is the number of people whose answers you collect; for an inspection, the number of items you check.
\(n_0\) n sub zero The calculated required sample size when the population is treated as very large. It is the value before the finite population correction.
\(z\) zee The z-score (a value on the standard normal distribution) for the confidence level. The customary values are 1.96 for 95% and 2.58 for 99%.
\(\hat{p}\) p-hat The proportion (such as the share of "yes" answers you want to know). To find the sample size, use your expected value; to find the margin of error, use the proportion you actually got in the survey (the sample proportion). Write it as a decimal from 0 to 1 (0.5 for 50%).
\(\varepsilon\) epsilon The margin of error, the gap you allow between the survey result and the true value. It is shown with ±, as in "±5%".
\(N\) capital N The population size, the number of people or items in the whole group you want to study (example - all 500 employees).

Terms

population The whole group you really want to know about, such as "every voter in the country" or "all 500 employees".
sample The part of the population that you pick out to actually study. The number of people or items in the sample is called the sample size.
random sampling Choosing the sample so that everyone in the population has the same chance of being picked, like drawing names from a hat. The formulas on this page assume random sampling and do not work for surveys where only the people who want to answer do.
population proportion The proportion you really want to know, such as the share of "yes" in the whole population. The proportion you get from a sample is called the sample proportion to tell them apart.
confidence level How certain you can be: if you repeated the same survey many times, the percentage of times the result would land within the margin of error. 95% is used most often.
confidence interval The range you get when you show a survey result with some width, as in "52% ± 3% (49% to 55%)". The margin of error ±ε on this page is that width.
margin of error The gap you allow between the survey result and the true value. It is what news polls mean by "a margin of error of ±3 points".
finite population correction A correction that lowers the required sample size or the margin of error when you know the population has a limited size. It reflects the fact that the more of the population you study, the more certain the result.

Good to know before you start

Here is what helps you use the calculation on this page with real understanding, not just by pressing the button.

Percents and ratios (Grade 6)
  • Being able to switch between percents and decimals, such as 50% = 0.5 and 5% = 0.05
  • Knowing that "whole × percent = part"
Square roots (Grade 8)
  • Knowing a square root as "the number that gives this number when squared", as in \(\sqrt{0.0025} = 0.05\)
  • Having a feel for how square roots scale: when the number inside becomes a quarter, the square root becomes a half
Random sampling (Grade 7)
  • Knowing the difference between a census and a sample survey, and what "population" and "sample" mean
  • Knowing that unless the sample is chosen at random, you cannot correctly estimate what the population looks like
The normal distribution and statistical inference (high school statistics / AP Statistics)
  • Knowing that sample proportions vary in a shape close to a normal distribution (the idea of the central limit theorem)
  • Knowing the confidence interval idea that a 95% confidence level matches a z-score of 1.96

How to calculate it in Excel

Copy the whole table below and paste it into cell A1 in Excel. It works as is.
Table to find the required sample size (very large population)
z-score (1.96 for 95%) 1.96
Expected proportion (%) 50
Margin of error (%) 5
Calculated value n0 =B1^2*(B2/100)*(1-B2/100)/(B3/100)^2
Required sample size (rounded up) =ROUNDUP(B4,0)
Table for the finite population correction of the sample size
z-score (1.96 for 95%) 1.96
Expected proportion (%) 50
Margin of error (%) 5
Population size N 500
Value before correction n0 =B1^2*(B2/100)*(1-B2/100)/(B3/100)^2
Required sample size (corrected, rounded up) =ROUNDUP(B5/(1+(B5-1)/B4),0)
Table to find the margin of error (very large population)
z-score (1.96 for 95%) 1.96
Proportion from the survey (%) 60
Sample size n 100
Margin of error (%) =B1*SQRT(B2/100*(1-B2/100)/B3)*100
Table for the finite population correction of the margin of error
z-score (1.96 for 95%) 1.96
Proportion from the survey (%) 30
Sample size n 200
Population size N 1000
Margin of error before correction (%) =B1*SQRT(B2/100*(1-B2/100)/B3)*100
Corrected margin of error (%) =B5*SQRT((B4-B3)/(B4-1))
After pasting, the upper cells (from B1) are your inputs and the last row shows the calculated result.
In the first table, B4 shows 384.16 and B5 shows 385. The answer in the second table is 218, in the third about 9.60 (%), and in the fourth about 5.68 (%).
"^" is a power (squared), "SQRT" is the square root, and "ROUNDUP" is the function for rounding up.
Note that the calculator on this page adds one more for safety even when the calculated value is exactly a whole number, so for such round values it can differ from Excel's ROUNDUP by 1.

How to calculate it in Google Sheets

Copy the whole table below and paste it into cell A1 in Google Sheets. It works as is.
Table to find the required sample size (very large population)
z-score (1.96 for 95%) 1.96
Expected proportion (%) 50
Margin of error (%) 5
Calculated value n0 =B1^2*(B2/100)*(1-B2/100)/(B3/100)^2
Required sample size (rounded up) =ROUNDUP(B4,0)
Table for the finite population correction of the sample size
z-score (1.96 for 95%) 1.96
Expected proportion (%) 50
Margin of error (%) 5
Population size N 500
Value before correction n0 =B1^2*(B2/100)*(1-B2/100)/(B3/100)^2
Required sample size (corrected, rounded up) =ROUNDUP(B5/(1+(B5-1)/B4),0)
Table to find the margin of error (very large population)
z-score (1.96 for 95%) 1.96
Proportion from the survey (%) 60
Sample size n 100
Margin of error (%) =B1*SQRT(B2/100*(1-B2/100)/B3)*100
Table for the finite population correction of the margin of error
z-score (1.96 for 95%) 1.96
Proportion from the survey (%) 30
Sample size n 200
Population size N 1000
Margin of error before correction (%) =B1*SQRT(B2/100*(1-B2/100)/B3)*100
Corrected margin of error (%) =B5*SQRT((B4-B3)/(B4-1))
The same formulas as in Excel work as is. Copy the whole table, paste it into cell A1, and replace the numbers in column B with the values for your own survey.

How to calculate it in Python

import math

# Quick table from confidence level (%) to z-score (customary rounded values)
z_table = {80: 1.28, 85: 1.44, 90: 1.65, 95: 1.96, 98: 2.33, 99: 2.58}

# ---- Way 1: find the required sample size ----
confidence_level = 95    # confidence level (%)
population_ratio = 50    # expected proportion (%)
margin_of_error = 5      # margin of error (%)
population_size = None   # population size (None if unknown or very large)

z = z_table[confidence_level]
p = population_ratio / 100
e = margin_of_error / 100

raw_size = z ** 2 * p * (1 - p) / e ** 2   # value before correction
if population_size is not None:
    raw_size = raw_size / (1 + (raw_size - 1) / population_size)   # finite population correction
required_size = math.floor(raw_size) + 1   # smallest whole number above the calculated value (rounded up for safety)
print(f"Required sample size: {required_size}")

# ---- Way 2: find the margin of error ----
sample_size = 1000       # sample size actually surveyed
sample_ratio = 50 / 100  # proportion from the survey (0.5 for 50%)

error_ratio = z * math.sqrt(sample_ratio * (1 - sample_ratio) / sample_size)
print(f"Margin of error: ±{error_ratio * 100:.2f}%")
Runs with the standard library only. Way 1 calculates the required sample size (385 with the example values) and way 2 calculates the margin of error (±3.10% with the example values). Replace the numbers at the top with the conditions of your own survey and run it.

How to write it in LaTeX and other math languages (copy and paste)

Required sample size (when the population is very large)
n₀ = z² × p̂(1 − p̂) ÷ ε²
n_0 = \dfrac{z^2 \, \hat{p}(1-\hat{p})}{\varepsilon^2}
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <mrow>
    <msub><mi>n</mi><mn>0</mn></msub>
    <mo>=</mo>
    <mfrac>
      <mrow>
        <msup><mi>z</mi><mn>2</mn></msup>
        <mover accent="true"><mi>p</mi><mo>^</mo></mover>
        <mo>(</mo><mn>1</mn><mo>&#x2212;</mo><mover accent="true"><mi>p</mi><mo>^</mo></mover><mo>)</mo>
      </mrow>
      <msup><mi>&#x3B5;</mi><mn>2</mn></msup>
    </mfrac>
  </mrow>
</math>
n_0 = (z^2 hat(p)(1 - hat(p)))/(epsilon^2)
z^2*p*(1 - p)/err^2
n0 := z^2*p*(1 - p)/err^2;
n0 = z^2*p*(1 - p)/err^2;
n_0 = (z^2 p̂(1 − p̂))/ε^2
Finite population correction for the sample size (when you know the population size \(N\))
n = n₀ ÷ (1 + (n₀ − 1) ÷ N)
n = \dfrac{n_0}{1 + \dfrac{n_0 - 1}{N}}
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <mrow>
    <mi>n</mi>
    <mo>=</mo>
    <mfrac>
      <msub><mi>n</mi><mn>0</mn></msub>
      <mrow>
        <mn>1</mn><mo>+</mo>
        <mfrac>
          <mrow><msub><mi>n</mi><mn>0</mn></msub><mo>&#x2212;</mo><mn>1</mn></mrow>
          <mi>N</mi>
        </mfrac>
      </mrow>
    </mfrac>
  </mrow>
</math>
n = n_0/(1 + (n_0 - 1)/N)
n0/(1 + (n0 - 1)/nPop)
n := n0/(1 + (n0 - 1)/N);
n = n0/(1 + (n0 - 1)/N);
n = n_0/(1 + (n_0 − 1)/N)
Margin of error (when the population is very large)
ε = z × √(p̂(1 − p̂) ÷ n)
\varepsilon = z \sqrt{\dfrac{\hat{p}(1-\hat{p})}{n}}
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <mrow>
    <mi>&#x3B5;</mi>
    <mo>=</mo>
    <mi>z</mi>
    <msqrt>
      <mfrac>
        <mrow>
          <mover accent="true"><mi>p</mi><mo>^</mo></mover>
          <mo>(</mo><mn>1</mn><mo>&#x2212;</mo><mover accent="true"><mi>p</mi><mo>^</mo></mover><mo>)</mo>
        </mrow>
        <mi>n</mi>
      </mfrac>
    </msqrt>
  </mrow>
</math>
epsilon = z sqrt((hat(p)(1 - hat(p)))/n)
z*Sqrt[p*(1 - p)/n]
err := z*sqrt(p*(1 - p)/n);
err = z*sqrt(p*(1 - p)/n);
ε = z√((p̂(1 − p̂))/n)
Finite population correction for the margin of error (when you know the population size \(N\))
ε = ε₀ × √((N − n) ÷ (N − 1))
\varepsilon = \varepsilon_0 \sqrt{\dfrac{N-n}{N-1}}
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
  <mrow>
    <mi>&#x3B5;</mi>
    <mo>=</mo>
    <msub><mi>&#x3B5;</mi><mn>0</mn></msub>
    <msqrt>
      <mfrac>
        <mrow><mi>N</mi><mo>&#x2212;</mo><mi>n</mi></mrow>
        <mrow><mi>N</mi><mo>&#x2212;</mo><mn>1</mn></mrow>
      </mfrac>
    </msqrt>
  </mrow>
</math>
epsilon = epsilon_0 sqrt((N - n)/(N - 1))
err0*Sqrt[(nPop - n)/(nPop - 1)]
err := err0*sqrt((N - n)/(N - 1));
err = err0*sqrt((N - n)/(N - 1));
ε = ε_0 √((N − n)/(N − 1))

How to have ChatGPT  do the calculation

You are a calculation assistant for statistical surveys. Do the following calculation by actually running Python code, and base your answer only on the numbers from the execution result (do not answer by mental math or guessing).

A service with 1,000 members is running a satisfaction survey. Use a 95% confidence level (z-score 1.96), an expected proportion of 50%, and a margin of error of ±5%.
Find each of the following:
1. The required sample size when the population is treated as very large (the calculated value and the number of people after rounding up)
2. The required sample size with the finite population correction for a population of 1,000
3. The margin of error (with the finite population correction, in %) if only 200 people respond

Show the formulas you used and the numbers from the execution result.

How to Use
  1. 1
    Enter your numbers
    Type the numbers you want to calculate with into the input fields
  2. 2
    Calculate
    Press the "Calculate" button
  3. 3
    Check the result
    The result appears on the spot. The same page also explains the idea behind the calculation and the formula
  DataChef Features
Easy and Free
Unlimited conversions for free.
No technical knowledge required.
Intuitive and user-friendly operation.
No Registration Required
Available immediately after access.
Can be used without registering personal information.
Safe and Secure
Fully SSL encrypted communication.
Automatic file deletion by clicking "download".
Fast
High-speed site access
and rapid file conversion.
No Watermark
No watermark.
No attribution required.
Commercial Use Available
Free for commercial use.
No need to contact us for commercial use permission.