Confidence Interval Using t-Distribution Calculator

Compute a confidence interval for a population mean using Student's t-distribution

Overview

This calculator computes the confidence interval for a population mean using Student's t-distribution. Enter the sample size, sample mean, sample standard deviation, and desired confidence level to get the margin of error and the lower/upper bounds.

Use this calculator when: the population standard deviation \( \sigma \) is unknown and estimated by the sample standard deviation \( s \). This is the most common real-world situation. If \( \sigma \) is known (from prior data or theory), use the Z-distribution calculator instead.

Interactive Confidence Interval Calculator

Enter your parameters. Sample size must be an integer ≥ 2; confidence level must be strictly between 0 and 100.

Results


Definition & Formula

For a sample of size \(n\) with mean \( \bar X \) and sample standard deviation \( s \), the \( (1-\alpha)\cdot 100\% \) confidence interval for the population mean \( \mu \) is:

t-Confidence Interval Formula

\[ \bar X \;\pm\; t_{\alpha/2,\, n-1} \cdot \frac{s}{\sqrt{n}} \]

Or, as an interval:

\[ \left[\; \bar X - t_{\alpha/2,\, n-1} \frac{s}{\sqrt n} \;\;,\;\; \bar X + t_{\alpha/2,\, n-1} \frac{s}{\sqrt n} \;\right] \]

The quantity \( t_{\alpha/2,\, n-1} \cdot s/\sqrt{n} \) is the margin of error. Here \( t_{\alpha/2,\, n-1} \) is the critical value of the t-distribution with \( n - 1 \) degrees of freedom, chosen so that \( \alpha/2 \) of the area lies in each tail.

Common critical values of \( t_{\alpha/2,\, n-1} \)

Critical values of t (two-tailed)
Confidence df = 5 df = 10 df = 20 df = 30 df = ∞ (Z)
90%2.0151.8121.7251.6971.645
95%2.5712.2282.0862.0421.960
99%4.0323.1692.8452.7502.576

Why the t-distribution? When \( \sigma \) is unknown, estimating it with \( s \) introduces extra uncertainty. The t-distribution accounts for this by having fatter tails than the normal, especially for small \( n \). As \( n \to \infty \), the t-distribution converges to the standard normal — which is why the "df = ∞" column matches the Z critical values.

Graphical Interpretation

On the t-distribution curve, the confidence level is the central area between the lower and upper bounds. The remaining probability \( \alpha \) is split equally between the two tails (each has area \( \alpha/2 \)):

t-distribution curve with the central confidence band between two critical t-values; the two equal tails together make up α
Figure 1 — Confidence level as the central area; the two equal tails sum to \( \alpha \).

When to Use This Formula

The t-confidence interval is appropriate when:

  1. \( \sigma \) is unknown. This is the most common real-world situation; if \( \sigma \) is known from prior data or theory, use the Z-interval instead.
  2. The sample is drawn from an approximately normal population. This assumption matters most when \( n \) is small. For \( n \ge 30 \), the Central Limit Theorem often makes the interval robust to mild non-normality.
  3. Observations are independent. Typically ensured by simple random sampling.

On the "n < 30" rule of thumb. Some textbooks introduce the t-distribution only when \( n < 30 \). More precisely: the t-distribution is the correct choice whenever \( \sigma \) is unknown, regardless of \( n \). For very large \( n \), the t and Z critical values become nearly identical, so the choice doesn't matter much numerically — but the t is still technically correct.


Worked Example — 95% CI for a Mean

A sample of \( n = 10 \) observations has mean \( \bar X = 5 \) and sample standard deviation \( s = 2.5 \), drawn from an approximately normal population with unknown \( \sigma \). Compute the 95% confidence interval for \( \mu \).

View solution

Step 1 — Degrees of freedom.

\[ \text{df} = n - 1 = 9 \]

Step 2 — Critical value. For 95% confidence with df = 9:

\[ t_{0.025, 9} \approx 2.2622 \]

Step 3 — Standard error.

\[ \text{SE} = \frac{s}{\sqrt{n}} = \frac{2.5}{\sqrt{10}} \approx 0.79057 \]

Step 4 — Margin of error.

\[ \text{MOE} = 2.2622 \cdot 0.79057 \approx 1.78844 \]

Step 5 — Interval.

\[ [\, 5 - 1.78844,\;\; 5 + 1.78844 \,] \approx [\,3.2116,\;\; 6.7884\,] \]

Answer: we are 95% confident that the population mean lies between about 3.2116 and 6.7884.


Practice Problems

Practice 1 — Compute a 90% CI

A sample of size \( n = 15 \) has \( \bar X = 20 \) and \( s = 4 \). Compute the 90% CI for \( \mu \).

Answer

df = 14, \( t_{0.05, 14} \approx 1.7613 \), SE = \( 4/\sqrt{15} \approx 1.03280 \), MOE ≈ 1.8190.

\[ \text{CI} \approx [\,18.1810,\;\; 21.8190\,] \]

Practice 2 — Wide vs. narrow

Same sample as Practice 1 (n = 15, x̄ = 20, s = 4). Compute the 99% CI and compare widths with the 90% CI.

Answer

\( t_{0.005, 14} \approx 2.9768 \), MOE ≈ \( 2.9768 \times 1.03280 \approx 3.0745 \).

\[ \text{99\% CI} \approx [\,16.9255,\;\; 23.0745\,] \]

The 99% CI is roughly 1.69× wider than the 90% CI — the cost of higher confidence.

Practice 3 — df effect on critical value

For 95% confidence, compare \( t_{0.025, 5} \) with \( t_{0.025, 50} \). What does this tell you about the sample size needed for the t-CI to closely approximate the Z-CI?

Answer

\( t_{0.025, 5} \approx 2.571 \), \( t_{0.025, 50} \approx 2.009 \), \( z_{0.025} = 1.960 \).

With df = 5, the t-critical value is 31% above the Z-value. With df = 50, it's only 2.5% above. So for \( n \ge 50 \), the t and Z intervals are nearly identical — the t's extra conservatism matters mostly for small samples.

Frequently Asked Questions

What is the formula for a confidence interval using the t-distribution?

\( \bar X \pm t_{\alpha/2, n-1} \cdot s/\sqrt{n} \), where \( \bar X \) is the sample mean, \( s \) is the sample standard deviation, \( n \) is the sample size, and \( t_{\alpha/2, n-1} \) is the critical value from Student's t-distribution with \( n - 1 \) degrees of freedom.

When should I use the t-distribution vs. the Z-distribution?

Use the t-distribution whenever \( \sigma \) is unknown and estimated from the sample — the most common case. This applies regardless of \( n \). Use the Z-distribution when \( \sigma \) is known from prior data or theory and either the population is normal or \( n \ge 30 \).

What are degrees of freedom in a t-confidence interval?

For a one-sample CI, df = \( n - 1 \). One degree is "used up" by estimating the sample mean, leaving \( n - 1 \) for estimating the spread.

What assumptions does the t-confidence interval make?

(1) The sample comes from an approximately normal population (especially important for small \(n\); for \(n \ge 30\) the CLT often makes the CI robust to mild non-normality). (2) Observations are independent — usually ensured by simple random sampling.

Related Statistical Calculators & Resources

Last updated: October 20, 2026