t-Statistic Calculator

T-Statistic Calculator

Compute the t-statistic and p-values for hypothesis testing of a sample mean against a hypothesized population mean.

Last updated: March 2026

Calculator

Mean of your sample

Null hypothesis value

Sample SD

Number of observations

T-Statistic
3.2353
df = 24
Standard Error (SE)1.700000
Two-tailed p-value0.0423
Left-tailed p-value0.9788
Right-tailed p-value0.0212
Significance (α=0.05)?Yes (reject H₀)

What is a T-Statistic?

The t-statistic measures how many standard errors the sample mean is away from the hypothesized population mean. Formula: t = (x̄ − μ₀) / SE, where SE = s / √n. The t-distribution accounts for uncertainty in estimating the population SD from a sample, making it appropriate for small samples (n < 30) where the normal distribution may not apply.

The t-statistic follows a t-distribution with (n − 1) degrees of freedom. The further the t-statistic is from zero, the stronger the evidence against the null hypothesis. P-values derived from the t-distribution tell us the probability of observing a t-statistic as extreme or more extreme if the null hypothesis is true.

T-tests are fundamental in hypothesis testing: compare a sample to a population value (one-sample t-test), compare two independent samples (two-sample t-test), or compare paired measurements (paired t-test).

How to Calculate T-Statistic

One-Sample T-Test

Step 1: Calculate sample mean (x̄) and sample SD (s)
Step 2: Calculate standard error: SE = s / √n
Step 3: Calculate t-statistic: t = (x̄ − μ₀) / SE
Step 4: Find p-value using t-distribution with df = n − 1
Step 5: Compare p-value to α (typically 0.05) to make decision

Formulas

T-Statistic:
t = (x̄ − μ₀) / (s / √n)
Degrees of Freedom:
df = n − 1
Decision Rule (α = 0.05):
If p-value < 0.05: reject H₀ (significant difference)
If p-value ≥ 0.05: fail to reject H₀ (no significant difference)

Real-World Example

Quality Control: Checking Machine Calibration

Scenario:
A factory machine is supposed to produce weights of exactly 500g. An inspection tests 25 units and finds: mean = 505g, SD = 8.5g. Is the machine correctly calibrated?
Calculation:
H₀: μ = 500 (machine OK)
H₁: μ ≠ 500 (machine miscalibrated)
SE = 8.5 / √25 = 8.5 / 5 = 1.7g
t = (505 − 500) / 1.7 = 5 / 1.7 = 2.941
df = 24, two-tailed p-value ≈ 0.0075
Since p-value (0.0075) < 0.05: reject H₀. The machine is significantly miscalibrated—it's producing weights too high.

Frequently Asked Questions

When should I use t-test vs z-test?

Use t-test when σ is unknown and you estimate it from sample (s). Use z-test when σ is known or n {'>'} 30 (where t-distribution ≈ normal). For small samples, always use t-test.

What does df = n − 1 mean?

Degrees of freedom represent free variability in the data. With n observations and a constraint (knowing the mean), you have n − 1 independent pieces of information. df affects the shape of the t-distribution—smaller df means wider tails (more conservative).

What's the difference between one-tailed and two-tailed tests?

Two-tailed: tests if μ ≠ μ₀ (difference in either direction). One-tailed: tests if μ {'>'} μ₀ or μ {'<'} μ₀ (specific direction). Two-tailed p-values are 2× one-tailed for the same |t|.

How do I interpret p-values?

P-value is the probability of observing a t-statistic as extreme (or more) if H₀ is true. p {'<'} 0.05 usually means reject H₀. p ≥ 0.05 means fail to reject H₀. Low p-values indicate strong evidence against H₀.

Can t be negative?

Yes. If x̄ {'<'} μ₀, then t is negative. The sign indicates direction of deviation. For two-tailed tests, we use |t| or square it. For one-tailed tests, the sign matters for the hypothesis.

What's the relationship between t-statistic and confidence interval?

A 95% CI for μ = x̄ ± t* × SE, where t* is the critical value. If 0 is outside the CI, you reject H₀ at α=0.05. They're two ways of testing the same hypothesis.

Related Tools