standarddeviationcalculator.net SD Calculator

Confidence interval calculator

Share this page

Favorites

    No favorites yet. Press Favorite on any page to keep it here.

    Methodology

    Enter a sample mean, its standard deviation and the sample size to get a confidence interval for the population mean. The calculation uses the t distribution, which is the correct choice when the population standard deviation is estimated from the sample.

    95% confidence interval 23.8317 to 26.9683
    Lower limit23.8317
    Upper limit26.9683
    Margin of error1.56831
    Standard error0.766812
    t* (df = 29)2.0452
    Interval width3.13661
    x̄ = 25.4 23.83 26.97

    The curve is the sampling distribution of the mean. The bar beneath it spans the 95% interval. Repeat the sampling many times and about 95% of the intervals built this way would contain the true mean. It is not a 95% chance that this particular one does.

    Show the working, step by step

    Confidence interval formula

    CI = x̄ ± t* × (s / √n)

    Read it in three pieces:

    • s / √n is the standard error: how much the sample mean itself would wobble from sample to sample.
    • t* is the critical value for your confidence level with n − 1 degrees of freedom. It sets how many standard errors wide the interval reaches.
    • x̄ ± centres the interval on your sample mean.

    Critical t values

    df (n − 1)90%95%99%
    52.0152.5714.032
    101.8122.2283.169
    201.7252.0862.845
    301.6972.0422.750
    1001.6601.9842.626
    ∞ (z)1.6451.9602.576

    Notice how sharply the values fall as df rises, and how much wider a 99% interval is than a 90% one. At df = 5 the 99% critical value is twice the 90% one. Small samples pay heavily for extra confidence.

    Confidence interval: a worked example

    A sample of 30 measurements has a mean of 25.4 and a standard deviation of 4.2, and you want a 95% interval.

    1. Standard error: 4.2 ÷ √30 = 4.2 ÷ 5.4772 = 0.7668.
    2. Critical value at 95% with df = 29: t* = 2.0452.
    3. Margin of error: 2.0452 × 0.7668 = 1.568.
    4. Interval: 25.4 ± 1.568 = 23.83 to 26.97.

    Reported properly: "mean 25.4, 95% CI [23.83, 26.97]". The width of that interval is the honest statement of how much the estimate can be trusted. A point estimate on its own hides exactly that.

    Reading intervals well

    • Width matters more than the point estimate. A mean of 25.4 with an interval of [25.1, 25.7] and one with [10, 41] are very different results, despite the identical centre.
    • Overlapping intervals do not settle a comparison. Two groups whose intervals overlap slightly can still differ significantly. Test the difference directly rather than eyeballing the bars.
    • Check what an error bar represents. Published figures show SD, standard error or confidence intervals almost interchangeably, and they are wildly different widths. The caption should say. If it does not, be suspicious.
    • This interval is for the mean. To put a range around the spread instead, use the confidence interval for the standard deviation, which uses the chi-square distribution.

    Sample size, margin of error and standard error are in the sampling and estimation calculators.

    Confidence interval calculator: the worked example on this page, with its result and chart
    Confidence interval calculator: the worked example above, at a glance.

    Common questions

    What does a 95% confidence interval actually mean?

    It means that if you repeated the whole sampling procedure many times and built an interval this way each time, about 95% of those intervals would contain the true population mean.

    It does not mean there is a 95% probability that the true mean lies inside the particular interval you calculated. That interval either contains it or it does not. The 95% describes the reliability of the method, not this one result.

    Should I use t or z?

    Use t when the population standard deviation is unknown and you are estimating it from the sample, which is nearly always. Use z only when σ is genuinely known in advance, which is rare outside textbook problems.

    This calculator uses t. For large n the two converge. At n = 1000 the 95% t critical value is 1.9623 against z's 1.9600.

    How do I make a confidence interval narrower?

    Three levers, in order of usefulness. Increase n: the width shrinks with √n, so quadrupling the sample halves the interval. Reduce the underlying variability through better measurement or a more homogeneous group. Accept a lower confidence level: 90% gives a narrower interval than 95%, at the cost of being wrong more often.

    What assumptions does this make?

    That the data are a random sample of independent observations, and that either the underlying distribution is roughly normal or n is large enough for the central limit theorem to apply, conventionally n ≥ 30, though heavily skewed data needs more.