Free Online Statistics Tool

Confidence Interval Calculator

Find the confidence interval and the margin of error for a mean or for a survey percentage. Use a t or z critical value, choose your confidence level and see every step.

Confidence Interval and Margin of Error Calculator

Choose what you are estimating, enter your numbers and get your result instantly.

Step-by-Step Solution

    What Is a Confidence Interval?

    A confidence interval is a range of values that is likely to contain the true value you are trying to estimate, such as the true mean of a whole group. Instead of giving one number from a sample, it gives a lower limit and an upper limit.

    The confidence level, such as 95%, describes how reliable the method is. If you repeated the sampling many times and built an interval each time, about 95% of those intervals would contain the true value.

    What Is the Margin of Error?

    The margin of error is the distance from the middle of the interval to either end. It is the “plus or minus” part of a result. A confidence interval is simply the estimate plus and minus the margin of error.

    The margin of error is built from the standard error of the mean multiplied by a t or z value.

    Confidence Interval = Estimate ± Margin of Error

    A smaller margin of error means a narrower interval and a more precise estimate.

    Confidence Interval Formulas

    For a mean

    Margin of Error = t × s ÷ √n
    Interval = x̄ ± Margin of Error

    Here x̄ is the sample mean, s is the sample standard deviation, n is the sample size and t is the critical value from the t distribution with n − 1 degrees of freedom. If the population standard deviation is known, the z critical value is used instead, together with that known standard deviation.

    For a proportion (survey percentage)

    Margin of Error = z × √( p × (1 − p) ÷ n )
    Interval = p ± Margin of Error

    Here p is the sample proportion (the percentage divided by 100) and n is the sample size. This simple method works best when the sample is large enough that both n × p and n × (1 − p) are at least 10.

    t or z: Which Should You Use?

    Use t when you estimate the standard deviation from your sample. This is the usual case, and it is the safe default. The t distribution has heavier tails than the normal distribution, so it gives a slightly wider interval, especially for small samples.

    Use z only when the true population standard deviation is known from outside your sample. For large samples, the two give very close results. To learn more about z, see our Z Score Calculator.

    Confidence Interval Calculator Examples

    Example 1: from a mean, standard deviation and sample size

    A sample of 25 values has a mean of 50 and a standard deviation of 10. Find the 95% confidence interval.

    Mean = 50, SD = 10, n = 25, confidence level = 95%

    The standard error is 10 ÷ √25 = 2. With 24 degrees of freedom, the t critical value is about 2.0639. The margin of error is about 2.0639 × 2 = 4.1278, so the interval is about 45.87 to 54.13.

    Example 2: from a data set

    2, 4, 4, 4, 5, 5, 7, 9

    The mean is 5, the sample standard deviation is about 2.1381 and n = 8, so the standard error is about 0.7559. With 7 degrees of freedom, the 95% t critical value is about 2.3646. The margin of error is about 1.7875, and the interval is about 3.21 to 6.79.

    Example 3: a survey percentage

    In a survey of 1,000 people, 50% give a certain answer. Find the 95% margin of error.

    Percentage = 50%, n = 1000, confidence level = 95%

    The z critical value is about 1.96. The margin of error is 1.96 × √(0.5 × 0.5 ÷ 1000), which is about 0.031, or 3.1 percentage points. The interval is about 46.9% to 53.1%.

    What Affects the Width of the Interval?

    • Confidence level: a higher level, such as 99%, gives a wider interval than 95%.
    • Sample size: a larger sample gives a narrower interval. To halve the margin of error, you need about four times as many values.
    • Variability: data that is more spread out, with a larger standard deviation, gives a wider interval.

    You can see the effect of sample size and spread directly in the Standard Error Calculator, since the margin of error is the standard error multiplied by the critical value.

    How to Interpret a Confidence Interval

    A 95% confidence interval of 45.87 to 54.13 does not mean there is a 95% chance that a particular sample falls in that range. It means that the method used to build the interval captures the true value in about 95% of repeated samples.

    In everyday use, you can read it as a range of believable values for the true mean. Keep in mind that the result relies on a random, representative sample, and the t method assumes the data is roughly normal or the sample is reasonably large.

    More Confidence Interval Examples

    These extra worked examples show how the confidence level and the sample size change the width of an interval, why a small sample needs the t value, and how to find the margin of error for a survey percentage. Remember that the margin of error is the critical value multiplied by the standard error.

    Example 4: Changing the confidence level to 99%

    Use the data from Example 1 (mean 50, standard deviation 10, n = 25) and find the 99% confidence interval.

    Answer: the 99% confidence interval is about 44.41 to 55.59.

    The standard error is 10 ÷ √25 = 2. With 24 degrees of freedom, the 99% t critical value is about 2.7969. The margin of error is about 2.7969 × 2 = 5.5938, so the interval is 50 ± 5.5938, which is about 44.41 to 55.59. The 95% interval in Example 1 was about 45.87 to 54.13, so asking for more confidence gives a wider interval.

    Example 5: A larger sample

    Keep the mean at 50 and the standard deviation at 10, but now use n = 100. Find the 95% confidence interval.

    Answer: the 95% confidence interval is about 48.02 to 51.98.

    The standard error is 10 ÷ √100 = 1. With 99 degrees of freedom, the 95% t critical value is about 1.9842. The margin of error is about 1.9842 × 1 = 1.9842, so the interval is about 48.02 to 51.98. With n = 25 the margin of error was about 4.13, so using four times as many values made it a little less than half as large.

    Example 6: A very small sample

    Five measurements are 12, 15, 11, 14 and 13. Find the 95% confidence interval for the mean.

    Answer: the 95% confidence interval is about 11.04 to 14.96.

    Step 1: the mean is (12 + 15 + 11 + 14 + 13) ÷ 5 = 13. Step 2: the deviations are −1, 2, −2, 1 and 0, and the squared deviations are 1, 4, 4, 1 and 0, which add up to 10. Step 3: the sample variance is 10 ÷ 4 = 2.5, so the standard deviation is √2.5 ≈ 1.5811. Step 4: the standard error is 1.5811 ÷ √5 ≈ 0.7071. Step 5: with 4 degrees of freedom, the 95% t critical value is about 2.7764, so the margin of error is about 2.7764 × 0.7071 ≈ 1.9632. The interval is 13 ± 1.9632, which is about 11.04 to 14.96.

    If you wrongly used z = 1.96 here, the margin of error would be only about 1.3859, which gives a narrower interval of about 11.61 to 14.39. For a sample this small, that would make the estimate look more precise than it really is.

    Example 7: A survey result of 60%

    In a survey of 400 people, 60% say yes. Find the 95% confidence interval for the true percentage.

    Answer: the margin of error is about 4.8 percentage points, and the interval is about 55.2% to 64.8%.

    The sample proportion is p = 0.6. The standard error is √(0.6 × 0.4 ÷ 400) = √0.0006 ≈ 0.0245. The z critical value for 95% is 1.96, so the margin of error is about 1.96 × 0.0245 ≈ 0.0480, which is 4.8 percentage points. The interval is 60% ± 4.8%, which is about 55.2% to 64.8%. The method works here because both n × p = 240 and n × (1 − p) = 160 are at least 10.

    Common mistakes when finding a confidence interval

    A common mistake is using z instead of t when the standard deviation comes from a small sample. Another is confusing the standard deviation with the standard error: the margin of error uses the standard error, which is s ÷ √n. Also remember that a 95% interval does not mean there is a 95% chance that your one sample falls inside it. To find the standard error from your data, use our Standard Error Calculator.

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

    Found a mistake or have a suggestion? Contact us.

    How to Use Our Confidence Interval Calculator

    1. Choose what you want to estimate: a mean (from summary numbers or your own data) or a survey percentage.
    2. Enter your numbers in the boxes.
    3. Choose your confidence level, and for a mean choose t or z.
    4. Click the Calculate Confidence Interval button.
    5. Read the lower and upper limits, the margin of error and the critical value, then check the step-by-step solution.

    Click Reset at any time to clear everything and start again. For the summary numbers of your data, you can first use the Descriptive Statistics Calculator.

    Why Use SmartStatCalc?

    SmartStatCalc is built to make everyday statistics quick and easy to understand. Instead of looking up critical values in a table, you can enter your numbers and see a clear result right away.

    Free to UseFind a confidence interval online without an account or any payment.
    No Tables NeededThe t and z critical values are worked out for you for any sample size.
    Step-by-Step ResultsSee the standard error, the critical value and the margin of error.
    Works on Any DeviceUse it on your phone, tablet, or computer. Your numbers stay in your browser.

    Who Can Use a Confidence Interval Calculator?

    Students use confidence intervals in statistics and science classes. Researchers use them to report how precise an estimate is, and anyone who reads survey results can use the margin of error to judge how much to trust a percentage.

    Frequently Asked Questions

    What is a 95% confidence interval?

    It is a range built with a method that captures the true value in about 95% of repeated samples.

    How do I calculate the margin of error?

    Multiply the critical value (t or z) by the standard error. For a mean, the standard error is s ÷ √n.

    Should I use t or z?

    Use t when you estimate the standard deviation from your sample, which is the usual case. Use z only when the true population standard deviation is known.

    What are degrees of freedom?

    For the t method with one sample, the degrees of freedom are n − 1. They decide the exact shape of the t distribution.

    Does a bigger sample make the interval narrower?

    Yes. A larger sample size lowers the standard error, which makes the margin of error and the interval smaller.

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

    To be more confident of capturing the true value, the interval has to cover more possibilities, so it gets wider.

    How big a sample do I need for a survey percentage?

    For a margin of error of about 3 percentage points at 95% confidence, you need roughly 1,000 responses when the true percentage is near 50%.

    Is this Confidence Interval Calculator free?

    Yes. SmartStatCalc's Confidence Interval 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). Confidence Interval Calculator. https://smartstatcalc.com/confidence-interval-calculator/

    Scroll to Top