Degrees of Freedom Calculator

Compute df for the specific test you're running — one-sample, pooled and Welch's t-tests, paired t-test, chi-square goodness-of-fit and independence, one-way ANOVA and simple linear regression.

Formula: df = n − 1

Degrees of freedom explained, step by step

Every parameter you estimate from data costs one degree of freedom. Each card below covers one place df shows up in the tests this calculator supports.

1. Degrees of freedom — what stays free after constraints

Degrees of freedom is the count of values that are still free to vary after every constraint your calculation imposes is fixed. Every parameter you estimate from the data burns one degree. That's why the sample standard deviation divides by n − 1: once the mean is fixed, only n − 1 residuals are free.

df = n − (parameters estimated)
5
12
9
14?
mean = 10 fixes the 4th value
Example
Given
n = 4
mean fixed
Substitute
df = 4 − 1
Answer
df = 3

2. df by test — the standard formulas

Most tests have a plug-in formula: one-sample t uses n − 1, pooled two-sample t uses n₁ + n₂ − 2, paired t uses n_pairs − 1, chi-square goodness of fit uses k − 1, chi-square independence uses (r − 1)(c − 1), one-way ANOVA reports (k − 1, N − k), and simple linear regression residuals use n − 2.

t: n − 1  ·  χ² ind: (r − 1)(c − 1)  ·  ANOVA: (k − 1
N − k)
one-sample t: n − 1
pooled t: n₁ + n₂ − 2
χ² ind: (r − 1)(c − 1)
ANOVA: k − 1 & N − k
Example
Given
3×4 contingency table
Substitute
df = (3 − 1)(4 − 1)
Answer
df = 6

3. Welch–Satterthwaite — the non-integer df

Welch's two-sample t-test uses a moment-matched df that depends on both sample sizes and both variances. It's usually non-integer and never exceeds the pooled df. Round down (never up) if you must consult a printed table.

df = (s₁²/n₁ + s₂²/n₂)² / ((s₁²/n₁)²/(n₁ − 1) + (s₂²/n₂)²/(n₂ − 1))
Example
Given
s₁=10
n₁=15
s₂=15
n₂=20
Substitute
17.917² / 9.836
Answer
df ≈ 32.64

4. Why it matters — a family of curves

The t, χ² and F distributions are indexed by df — small df means heavier tails and larger critical values. Plugging the wrong df into the same statistic can push a p-value from 0.03 to 0.10 with no other change. Feed the df from this calculator directly into the matching test tool.

small df ⇒ heavier tails ⇒ wider critical value
Example
Given
t = 2.05
α = 0.05 two-tailed
Substitute
df = 5 vs df
= 50
Answer
p ≈ 0.096 vs 0.045

Features of this calculator

  • Eight test types on one page — no more guessing which df formula applies.
  • Live shape of the reference t-distribution rendered from the computed df.
  • Show / hide step-by-step working, including the full Welch-Satterthwaite expansion.
  • Handles the two most-confused cases explicitly: pooled vs Welch's t-test and chi-square GoF vs independence.

Frequently asked questions

+Does df depend on the data or just the sample size?
For t-tests, chi-square, ANOVA and simple linear regression, df depends only on counts (n, categories, rows × columns, number of groups). Welch's df is the exception: it also depends on the sample variances, which is why it's usually non-integer.
+Why does Welch's df come out non-integer?
Because it's an approximation (the Welch-Satterthwaite equation) that matches the moments of a t-distribution to the actual sampling distribution of Welch's statistic — it isn't derived from a simple counting argument.
+What's df for a two-way ANOVA?
For factors A (a levels), B (b levels) and n replicates per cell: df_A = a − 1, df_B = b − 1, df_AB = (a − 1)(b − 1), df_error = ab(n − 1). This page focuses on the eight most-used forms — two-way ANOVA is on the roadmap.
+Is df ever infinite?
Effectively yes — as df → ∞ the t-distribution becomes the standard normal and the χ²/df ratio becomes a constant. In practice, for n ≥ ~30 the t and Z answers already agree to 2–3 decimals.
+Do I need df if I'm just computing a confidence interval?
Yes — the critical multiplier (Student t) depends on df. For a one-sample mean CI you'd use n − 1; for regression coefficients you'd use residual df.
+Why is df for regression n − 2 and not n − 1?
Because two parameters are estimated from the same data — the intercept and the slope. Each estimated parameter costs one degree. Multiple regression with p predictors plus intercept costs p + 1 degrees, so residual df = n − p − 1.

Related calculators