Science & Engineering

Degrees of Freedom Calculator (t, Chi-Square, ANOVA)

Degrees of freedom set which distribution your test statistic follows, and the formula changes with the test. Pick your test and enter the sample sizes to get df.

How to use
  1. Choose the test: one-sample t, two-sample t, chi-square, ANOVA, or regression.
  2. Enter the relevant sample sizes or table dimensions.
Common n
Degrees of freedom
24

25 − 1 = 24

For study and estimation. Verify against authoritative data before relying on a result.
Was this helpful?

How it's calculated

df = n − 1 (one-sample case)

one-sample t: n−1; two-sample t: n₁+n₂−2; chi-square: (r−1)(c−1); ANOVA: between = k−1, within = N−k; regression residual: n−p−1. n = sample size, r/c = rows/columns, k = groups, p = predictors.

Worked examples

Testdf formulaExampledf
One-sample tn - 1n = 2019
Two-sample t (pooled)n1 + n2 - 2n1 = 12, n2 = 1525
Chi-square independence(r-1)(c-1)3x4 table6
One-way ANOVA (between)k - 1k = 4 groups3

Common questions

What are degrees of freedom?

They are the number of values in a calculation that are free to vary. For a one-sample t-test with n observations, df = n - 1 because the sample mean fixes one value.

Why does df matter for a t-test?

It selects the exact t-distribution used to find the critical value and p-value. Fewer degrees of freedom give a wider distribution and a higher critical value.