Skip to content
    Statistics

    How to Calculate a Confidence Interval

    A poll says 52% ± 3%. Where does that ± 3% come from? It is a margin of error, and it turns one guess into an honest range. In this guide you'll learn how to calculate the margin of error and a confidence interval for a mean, step by step.

    Math Solver Academic Editorial Board5 min read

    Key takeaways

    • Margin of error: ME = z × (σ ÷ √n).
    • Confidence interval: from mean − ME to mean + ME.
    • Use z = 1.645 for 90%, 1.96 for 95% and 2.576 for 99%.
    • Divide σ by √n, not by n. Four times the sample halves the margin of error.
    In this guide
    1. 01What is a confidence interval?
    2. 02Why do confidence intervals matter?
    3. 03The formula
    4. 04How to calculate a confidence interval step by step
    5. 05Common mistakes to avoid
    6. 06Tips and tricks
    7. 07Where you'll use it in real life
    8. 08Quick summary
    9. 09Worked example
    10. 10Frequently asked questions

    What is a confidence interval?

    You cannot weigh every apple on a farm, so you weigh 36 of them. Their average is your best guess for all the apples, but it will not be perfect. A confidence interval adds a safety margin: 'the true average is probably between this and that'.

    The margin of error is how far that range reaches on each side of your sample mean.

    Why do confidence intervals matter?

    A single number like 'average apple weight: 150 g' sounds exact, but it came from a sample and could be off. A confidence interval is honest about that uncertainty. Scientists, doctors and pollsters report intervals so readers know how much to trust the result.

    A 95% confidence interval means: if you repeated the sampling many times, about 95% of the intervals you built would contain the true mean.

    The formula

    ME = z × (σ ÷ √n)
    Interval = mean − ME to mean + ME
    SymbolWhat it meansExample
    MEMargin of error3.92 g
    meanThe sample mean150 g
    σ (sigma)The standard deviation12 g
    nSample size36 apples
    zz value for the confidence level1.96 (95%)
    σ ÷ √nThe standard error2 g

    The calculator's main result is the margin of error. The steps then show the full interval from mean − ME to mean + ME.

    How to calculate a confidence interval step by step

    1. 1Find the sample mean and standard deviation. The standard deviation calculator can help.
    2. 2Find the standard error. Divide σ by √n: 12 ÷ √36 = 12 ÷ 6 = 2.
    3. 3Find the margin of error. Multiply by z: 1.96 × 2 = 3.92.
    4. 4Build the interval. 150 − 3.92 = 146.08 and 150 + 3.92 = 153.92.

    Now enter your own mean, standard deviation, sample size and z value in the calculator below.

    Try it yourself

    Pre-filled with the example — change any value.

    🧮
    Statistics
    University

    Confidence Interval (Margin of Error)

    Calculate the margin of error and confidence interval for a sample mean

    ME = z × (σ / √n)

    μ = 15068.2% (±1σ)
    μ: 150 | σ: 12
    1300
    145
    175
    120

    💡 Example

    Reference
    Inputs:mean=100, sd=15, n=25, z=1.96
    Result:5.88
    Open the full Confidence Interval (Margin of Error) calculator

    Common mistakes to avoid

    • Using the wrong z value. 1.96 is for 95%. Higher confidence needs a bigger z and gives a wider interval.
    • Using z for tiny samples. With a small sample and an unknown σ, statisticians usually use a t value instead of z.
    • Saying there is a 95% chance the mean is in this one interval. Strictly, the 95% describes the method, not one particular interval.
    • Forgetting the ±. The margin of error goes on both sides of the mean.

    Tips and tricks

    Confidence levelz value
    90%1.645
    95%1.96
    99%2.576
    • Quick 95% estimate: use z ≈ 2. Then ME ≈ 2 × σ ÷ √n.
    • Where does 1.96 come from? It is the z-score that leaves 2.5% in each tail of the normal distribution.

    Where you'll use it in real life

    • Opinion polls: the ± figure reported with election surveys.
    • Medicine: the likely range of a treatment's average effect.
    • Factories: checking whether the average fill of bottles is on target.
    • School projects: reporting the average of repeated measurements honestly.

    Quick summary

    A confidence interval is the sample mean plus or minus a margin of error, where ME = z × σ ÷ √n. Bigger samples give narrower intervals, and higher confidence gives wider ones. Use the calculator above to get the margin of error and the full interval with every step shown.

    Worked example

    A farmer weighs a sample of 36 apples. Their mean weight is 150 g and the standard deviation is 12 g. She wants a 95% confidence interval, so she uses z = 1.96.

    1. 01ME = z × (σ / √n)
    2. 02Standard error = 12 / √36 = 2
    3. 03ME = 1.96 × 2
    4. 04ME = 3.92
    5. 05Confidence interval = 146.08 to 153.92

    These numbers are pre-filled in the calculator above.

    Frequently asked questions

    What z value should I use for a 95% confidence interval?

    Use z = 1.96. For 90% use 1.645, and for 99% use 2.576.

    How do I make the margin of error smaller?

    Use a bigger sample. Because you divide by √n, taking four times as many measurements cuts the margin of error in half.

    What is the difference between margin of error and confidence interval?

    The margin of error is one number, the distance from the mean to each end. The confidence interval is the full range from mean − ME to mean + ME.

    Why is a 99% interval wider than a 95% interval?

    To be more confident that the range catches the true mean, you have to make the range bigger. The z value rises from 1.96 to 2.576, so the margin of error grows.

    #Statistics#University#Confidence Interval (Margin of Error)
    Updated

    Sponsored ToolsAd

    More tools on Ytools →
    Calcu.click — 25+ Free Smart Calculators preview

    Calcu.click — 25+ Free Smart Calculators

    Brand new calculation platform with 0ms reactive math, 100% client-side privacy, and dedicated subdomains. Fast calculators for EMI, SIP, Mortgage, Income Tax, BMI, Age, Percentage, and more.

    25+ CalculatorsFinanceHealth0ms Real-TimeFree
    Keyboard Arena preview

    Keyboard Arena

    Master touch typing with real-time WPM speed tests, mechanical switch audio, A-Z finger biomechanics drills, 40+ structured lessons, and competitive arcade games.

    Typing TestWPMTouch Typing
    Flutter Log Explorer preview

    Flutter Log Explorer

    Real-time structured log viewer and search explorer for Flutter & Dart. Zero-config capture from Debug Adapter (DAP) & Dart VM Service with smart classification and filters.

    FlutterDartVS Code ExtensionOpen VSX