Degrees of Freedom Calculator

Quick answer

The degrees of freedom calculator gives the df for one-sample, paired and two-sample t-tests (including Welch), chi-square goodness-of-fit and independence tests, one-way ANOVA and linear regression, plus the matching critical value at your chosen significance level.

Degrees of freedom
24
Critical value at α (two-tailed t, right-tailed χ² or F)
2.0639

Degrees of freedom count how many values in a calculation are free to vary once certain quantities have been fixed. If five numbers must average 10, you can choose any four of them, but the fifth is then forced – so a sample standard deviation computed around the sample mean has n − 1 degrees of freedom. Each parameter estimated from the data uses up one degree of freedom.

Degrees of freedom matter because they decide the exact shape of the t, chi-square and F distributions used to get p-values and critical values. A t-test with 4 df has much heavier tails than one with 40 df, so the same t statistic is far less convincing. Using the wrong df therefore gives the wrong p-value.

Every test has its own rule. Two-sample t-tests lose two df for the two group means; Welch’s version replaces that with the Welch–Satterthwaite approximation, which is usually not a whole number. Chi-square tests depend on the number of categories or table cells, ANOVA has separate df between and within groups, and regression loses one df for each coefficient including the intercept.

How to use the Degrees of Freedom Calculator

  1. Statistical test
  2. Sample size n (number of pairs for a paired test)
  3. Size of sample 1 (n₁)
  4. Size of sample 2 (n₂)
  5. Standard deviation of sample 1 (s₁)
  6. Standard deviation of sample 2 (s₂)
  7. Number of categories (k)
  8. Parameters estimated from the data (m)
  9. Number of rows (r)
  10. Number of columns (c)
  11. Number of groups (k)
  12. Total number of observations (N)
  13. Number of predictors (p, not counting the intercept)
  14. Significance level (α)

Results update as you type, and everything is calculated in your browser.

How it works

Choose the test and enter the sample sizes or table dimensions it needs. The calculator applies the matching formula and also returns the critical value of t, χ² or F at your α, so you can check a result against a table.

Worked example

A one-sample t-test on 25 measurements has df = 25 − 1 = 24, and the two-tailed critical t at α = 0.05 is 2.0639.

For Welch’s test with s₁ = 4.2, n₁ = 12, s₂ = 7.5 and n₂ = 15: s₁²/n₁ = 1.47 and s₂²/n₂ = 3.75, so df = 5.22² ÷ (1.47²/11 + 3.75²/14) = 27.248 ÷ 1.2009 = 22.69 – smaller than the pooled 25 because the noisier group carries more weight.

Degrees of freedom by test

Test Degrees of freedom Distribution
One-sample or paired t-test n − 1 t
Two-sample t-test (pooled) n₁ + n₂ − 2 t
Welch t-test Welch–Satterthwaite t
χ² goodness of fit k − 1 − m χ²
χ² independence (r − 1)(c − 1) χ²
One-way ANOVA k − 1, N − k F
Linear regression p, n − p − 1 t and F

Inputs explained

Field What to enter
Statistical test Choose one: One-sample t-test, Paired t-test, Two-sample t-test, equal variances (pooled), Two-sample t-test, unequal variances (Welch) …
Sample size n (number of pairs for a paired test) A number
Size of sample 1 (n₁) A number
Size of sample 2 (n₂) A number
Standard deviation of sample 1 (s₁) A number
Standard deviation of sample 2 (s₂) A number
Number of categories (k) A number
Parameters estimated from the data (m) A number
Number of rows (r) A number
Number of columns (c) A number
Number of groups (k) A number
Total number of observations (N) A number
Number of predictors (p, not counting the intercept) A number
Significance level (α) Choose one: 0.10, 0.05, 0.025, 0.01 …

What each result means

  • Within-groups (error) degrees of freedom N − k = [Total number of observations (N)] – [Number of groups (k)]
  • Total degrees of freedom N − 1 = [Total number of observations (N)] – 1
  • Residual degrees of freedom n − p − 1 = [Sample size n (number of pairs for a paired test)] – [Number of predictors (p, not counting the intercept)] – 1
  • Pooled df for comparison (n₁ + n₂ − 2) = [Size of sample 1 (n₁)] + [Size of sample 2 (n₂)] – 2

Formula

One-sample or paired t: df = n − 1 · Pooled two-sample t: df = n₁ + n₂ − 2 · Welch: df = (s₁²/n₁ + s₂²/n₂)² ÷ [(s₁²/n₁)²/(n₁ − 1) + (s₂²/n₂)²/(n₂ − 1)] · χ² goodness of fit: k − 1 − m · χ² independence: (r − 1)(c − 1) · ANOVA: k − 1 and N − k · regression: n − p − 1

Worked example

Inputs — Statistical test: One-sample t-test; Sample size n (number of pairs for a paired test): 25; Significance level (α): 0.05.
Results — Degrees of freedom = 24; Critical value at α (two-tailed t, right-tailed χ² or F) = 2.0639.

Key terms

Degrees of freedom (df)
The number of independent pieces of information left after estimating parameters.
Welch–Satterthwaite equation
Approximate df for a combination of variances with different sample sizes.
Error (residual) df
Degrees of freedom left for estimating the random variation, e.g. N − k in ANOVA.
Constraint
A fixed quantity, such as a sample mean or a row total, that removes one degree of freedom.

Frequently asked questions

How do I find degrees of freedom for a one-sample t-test?

Subtract 1 from the sample size: a sample of 25 has 24 df, and the two-tailed critical t at α = 0.05 is 2.064.

What are the degrees of freedom for a two-sample t-test?

With equal variances assumed, n₁ + n₂ − 2 – for samples of 12 and 15 that is 25. Welch's test uses a smaller, usually fractional, value from the Welch–Satterthwaite formula.

Why are Welch degrees of freedom not a whole number?

They come from an approximation that matches the variance of the combined standard error, so any positive value is possible. t-distributions are defined for non-integer df.

How many degrees of freedom does a chi-square test of independence have?

(rows − 1) × (columns − 1). A 2×3 table has 2 df and a 4×4 table has 9.

What are the degrees of freedom in one-way ANOVA?

k − 1 between groups and N − k within groups. With 4 groups and 40 observations that is F(3, 36).

Why is it n − 1 and not n?

One degree of freedom is spent estimating the mean; the deviations from the sample mean must sum to zero, so only n − 1 of them are free.

How many degrees of freedom does a regression have?

The residual df is n − p − 1, where p counts the predictors and the 1 is the intercept. They are used for the t-tests on coefficients and the error variance.

Sources

  1. NIST/SEMATECH e-Handbook of Statistical Methods
  2. Penn State STAT 500 – Applied Statistics
  3. OpenStax – Introductory Statistics 2e

Cite this calculator

Speedy Calculator. (2026). Degrees of Freedom Calculator. Speedy Calculator. https://speedycalculator.com/calculators/statistics/degrees-of-freedom/