Degrees of Freedom Calculator

Calculate degrees of freedom for t-tests, ANOVA, chi-square, regression, and Welch's test with step-by-step formulas and a comprehensive reference table.

df
24
25 − 1 = 24

Calculation Details

ComponentdfFormula
df24n − 1

Quick Reference: df Formulas by Test

Statistical Testdf Formula
One-Sample tn − 1
Two-Sample t (equal var)n₁ + n₂ − 2
Welch's tWelch-Satterthwaite approximation
Paired tn_pairs − 1
One-Way ANOVA (between)k − 1
One-Way ANOVA (within)N − k
Two-Way ANOVA (interaction)(a−1)(b−1)
Chi-Square GoFk − 1
Chi-Square Independence(r−1)(c−1)
Simple Regression (residual)n − 2
Multiple Regression (residual)n − p − 1
Planning notes, formulas, and examples

About the Degrees of Freedom Calculator

Degrees of freedom (df) represent the number of independent pieces of information available to estimate a parameter. They appear in virtually every statistical test — t-tests, ANOVA, chi-square, regression — and using the wrong df produces incorrect p-values and critical values. Despite their importance, df formulas vary by test and are easy to confuse.

This calculator computes degrees of freedom for ten common statistical tests: one-sample t, two-sample t (equal variance), Welch's t (unequal variance with Satterthwaite approximation), paired t, one-way ANOVA, two-way ANOVA, chi-square goodness of fit, chi-square independence, simple regression, and multiple regression. Each test displays all relevant df components (between, within, total, residual) with the exact formula used.

The presets cover the most common scenarios, and the reference table provides a single-page summary of df formulas for all tests. Whether you're a student working through homework or a researcher double-checking a statistical analysis, This calculator ensures you get the df right every time.

When This Page Helps

Degrees of freedom formulas differ across statistical tests, and mixing them up is a common source of errors in homework, exams, and published research. This calculator covers all major tests in one place, eliminating the need to remember or look up individual formulas.

The step-by-step display shows exactly how each df component is computed from your inputs, making it an excellent learning tool. The comprehensive reference table serves as a permanent cheat sheet. For Welch's t-test, the Satterthwaite approximation is computed automatically — a calculation that's tedious by hand and easy to get wrong.

How to Use the Inputs

  1. Select the statistical test type from the dropdown menu.
  2. Enter the required parameters: sample size(s), number of groups, rows/columns, or predictors.
  3. For Welch's t-test, also enter the standard deviations for each group.
  4. Use presets for common scenarios to quickly fill in parameter values.
  5. Review the output cards showing each df component with its formula.
  6. Check the calculation details table for step-by-step computations.
  7. Use the quick reference table to look up df formulas for any test.
Formula used
One-Sample t: df = n − 1 Two-Sample t: df = n₁ + n₂ − 2 Welch's t: df = (s₁²/n₁ + s₂²/n₂)² / [(s₁²/n₁)²/(n₁−1) + (s₂²/n₂)²/(n₂−1)] Paired t: df = n_pairs − 1 One-Way ANOVA: df_between = k − 1, df_within = N − k Two-Way ANOVA: df_A = a−1, df_B = b−1, df_AB = (a−1)(b−1) Chi-Square GoF: df = k − 1 Chi-Square Independence: df = (r−1)(c−1) Regression: df_regression = p, df_residual = n − p − 1

Example Calculation

Result: df_between = 2, df_within = 57, df_total = 59

With 3 groups and 60 total observations, df_between = 3 − 1 = 2 (numerator for F-test), df_within = 60 − 3 = 57 (denominator), and df_total = 59. The F-test uses F(2, 57).

Tips & Best Practices

  • Total df always equals N − 1 (one less than the total sample size).
  • In ANOVA, df_between + df_within = df_total always checks out.
  • Welch's df is always ≤ the equal-variance df — it's more conservative.
  • For chi-square tests, df depends on table dimensions, not sample size.
  • In regression, increasing predictors reduces residual df and can inflate standard errors.
  • Always double-check df before looking up critical values or computing p-values.

The Concept of Degrees of Freedom

Imagine you have 5 numbers that must average to 10 (sum to 50). You can freely choose the first 4 numbers, but the 5th is forced by the constraint. You have 4 degrees of freedom. This extends to statistical estimation: every parameter you estimate from the data consumes one degree of freedom, leaving fewer for estimating variability.

In a one-sample t-test, you estimate the population mean from the data, consuming 1 df. With n observations, df = n − 1. In two-sample tests, you estimate two group means, but the pooled variance formula already accounts for this, giving df = n₁ + n₂ − 2.

Welch-Satterthwaite Approximation

When group variances are unequal, the standard t-test df formula doesn't work because the pooled variance is no longer appropriate. Welch proposed using separate variance estimates, but the resulting test statistic doesn't follow an exact t-distribution. Satterthwaite's approximation finds the effective df by matching the first two moments of the distribution. The result is typically a non-integer df between min(n₁, n₂) − 1 and n₁ + n₂ − 2.

Degrees of Freedom in Model Selection

In regression and machine learning, the trade-off between model complexity and residual df is central. Adding predictors improves fit but reduces df_residual. Adjusted R² penalizes for lost df, and information criteria (AIC, BIC) explicitly include df as a penalty term. The principle of parsimony says to use the fewest parameters that adequately explain the data — which means preserving as many degrees of freedom as possible.

Sources & Methodology

Last updated:

Frequently Asked Questions

  • df determine the shape of the sampling distribution used to compute p-values and critical values. Using wrong df gives wrong p-values, potentially leading to incorrect conclusions about statistical significance.