Hypothesis Testing

T-Test Calculator

Free t-test calculator for one-sample, two-sample & paired t-tests. Calculate t-value, p-value, degrees of freedom with step-by-step results.

What is a T-Test?

A t-test is a statistical test used to compare means. It helps determine whether there’s a significant difference between group means or between a sample mean and a known value.

Types of T-Tests

One-Sample T-Test

Compares a sample mean to a known or hypothesized population mean.

Use when: Testing if your sample differs significantly from a standard or expected value.

Two-Sample T-Test (Independent)

Compares the means of two independent groups.

Use when: Comparing two separate groups (e.g., treatment vs. control).

Paired T-Test

Compares means from the same group at different times or under different conditions.

Use when: Comparing before/after measurements on the same subjects.

T-Test Formulas

One-Sample T-Test

t = (x̄ - μ₀) / (s / √n)

Two-Sample T-Test (Welch’s)

t = (x̄₁ - x̄₂) / √(s₁²/n₁ + s₂²/n₂)

Understanding the Results

  • T-statistic: Measures the size of the difference relative to variation
  • Degrees of freedom: Related to sample size(s)
  • P-value: Probability of observing results if null hypothesis is true
  • Significance: If p-value < α (e.g., 0.05), the result is statistically significant

Assumptions of T-Tests

  1. Data is approximately normally distributed
  2. Random sampling from the population
  3. Independence of observations
  4. For two-sample: Similar variances (unless using Welch’s t-test)

Frequently Asked Questions

What is a t-test used for?

A t-test is used to compare means and determine if there’s a statistically significant difference between them. Use a one-sample t-test to compare a sample mean to a known value, two-sample to compare two independent groups, and paired to compare before/after measurements.

How do I calculate the t-value?

For a one-sample t-test: t = (sample mean - hypothesized mean) / (sample SD / √n). For two-sample: t = (mean₁ - mean₂) / √(s₁²/n₁ + s₂²/n₂). This calculator does the computation automatically.

What is a good t-value?

There’s no single “good” t-value—it depends on degrees of freedom and significance level. Generally, |t| > 2 suggests significance at α=0.05 for moderate sample sizes. Compare your t-value to the critical value from the t-table.

What does the p-value mean in a t-test?

The p-value is the probability of getting results as extreme as yours if there’s actually no difference (null hypothesis is true). p < 0.05 means there’s less than 5% chance the difference is due to random sampling—typically considered statistically significant.

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

Use t-test when population standard deviation is unknown (most real-world situations). Use z-test when population σ is known or sample size is very large (n > 100). The t-test is more conservative and appropriate for smaller samples.

What is the difference between one-tailed and two-tailed t-test?

A two-tailed test checks if means are different (either direction). A one-tailed test checks if one mean is specifically greater or less than the other. Use two-tailed unless you have a strong directional hypothesis before collecting data.


Advertisement

Want to learn the theory?

Our lessons explain the statistical concepts behind this calculator with clear examples.

Browse Lessons →