Sample Size Calculator

Proportion Hypothesis Testing

Shaded areas represent Confidence Level (blue) and Alpha tails (red).

Sample Size Formula for Single Proportion

How to Use This Calculator

1. Set Significance (α)

Choose your confidence level. A 95% level (Z=1.96) is the industry standard for most research.

2. Define Margin of Error (E)

Enter the maximum difference you'll allow between the sample and population. Use decimals (e.g., 0.05 for 5%).

3. Estimated Proportion (p̂)

If you have a pilot study or prior data (e.g., 30%), enter 0.30. If you have no idea, leave it blank.

Pro Tip: When you leave the proportion blank, the calculator uses 0.50. This is the "safe" approach because it requires the largest possible sample size to ensure your results are statistically significant.

Sample Size Calculation Examples

Example 1: Unknown Population Proportion

Imagine you are conducting a market research survey to estimate the percentage of people in a city who support a new green policy. Since you don't have prior data, we use the conservative estimate of \(p = 0.5\). To achieve a 95% Confidence Level (\(Z = 1.96\)) and a 5% Margin of Error (\(E = 0.05\)):

\[ n = \frac{(1.96)^2 \cdot 0.5(1 - 0.5)}{0.05^2} = \frac{3.8416 \cdot 0.25}{0.0025} = 384.16 \]

Result: You would need a sample size of 385 people.

Example 2: Using a Pilot Study (Specific \(p\))

Suppose a pilot study shows that roughly 30% (\(p = 0.3\)) of users prefer a dark mode interface. You want to verify this with a 99% Confidence Level (\(Z = 2.576\)) and a tighter 3% Margin of Error (\(E = 0.03\)):

\[ n = \frac{(2.576)^2 \cdot 0.3(1 - 0.3)}{0.03^2} = \frac{6.6358 \cdot 0.21}{0.0009} \approx 1548.35 \]

Result: The required sample size increases to 1,549 due to the higher confidence and lower error requirements.