Degrees of Freedom Calculator
This calculator works out the degrees of freedom (df) you need for seven common statistical tests, so you can find the correct critical value or p-value without doing the formula by hand. Choose your test from the dropdown: one-sample t-test, two-sample t-test (pooled or Welch), paired t-test, chi-square goodness of fit, chi-square test of independence, or one-way ANOVA. The calculator then asks for the relevant inputs, such as one or two sample sizes, the standard deviation of each sample for a Welch test, the number of categories for a goodness-of-fit test, the rows and columns of a contingency table, or the number of groups and total sample size for an ANOVA. It returns your degrees of freedom as the headline result, plus supporting figures such as the exact unrounded df and pooled df for a Welch test, or the within-groups and total df for an ANOVA, alongside a calculation detail box showing the formula used and which distribution, t, chi-square or F, applies. Use the df figure to find the matching row in a statistics table or enter it directly into statistical software when running your hypothesis test. Because it only calculates df, not the full test statistic or p-value, check you have selected the right test design, particularly whether a pooled or Welch t-test suits your data, before using the result.
1. Test Type
2. Additional Details
Calculation Detail
What This Means
What Are Degrees of Freedom?
Degrees of freedom (df) is the number of values in a calculation that are free to vary once certain constraints (such as a fixed sample mean) have been applied. In practice, df tells you which specific t-distribution, chi-square distribution, or F-distribution to use when working out a critical value or p-value for a hypothesis test. As df increases, these distributions approach the normal (t) or become more symmetric (chi-square), so the exact df matters most for small samples.
Degrees of Freedom Formulas
| Test | Degrees of Freedom Formula |
|---|---|
| One-sample t-test | df = n minus 1 |
| Paired t-test | df = n minus 1 (n = number of pairs) |
| Two-sample t-test, pooled (equal variances) | df = n1 + n2 minus 2 |
| Two-sample t-test, Welch (unequal variances) | Welch-Satterthwaite equation (see below), rounded down |
| Chi-square goodness of fit | df = k minus 1 (k = number of categories) |
| Chi-square test of independence | df = (rows minus 1) x (columns minus 1) |
| One-way ANOVA (between groups) | df = k minus 1 (k = number of groups) |
| One-way ANOVA (within groups / error) | df = N minus k (N = total sample size) |
The Welch-Satterthwaite Equation
When the two samples in an independent t-test have unequal variances, the standard n1 + n2 minus 2 formula overstates the precision of the test. Welch's t-test instead uses the Welch-Satterthwaite equation:
df = (s1²/n1 + s2²/n2)² / [ (s1²/n1)²/(n1 minus 1) + (s2²/n2)²/(n2 minus 1) ]
This produces a non-integer result that most software and textbooks round down to the nearest whole number. Welch's df will always be less than or equal to the pooled df (n1 + n2 minus 2), and is generally preferred whenever sample sizes or variances differ noticeably, since it does not assume equal population variances.
Why Degrees of Freedom Matter
Every t-distribution, chi-square distribution, and F-distribution is actually a family of curves, one for each value of df. Looking up the wrong df row in a statistical table (or entering the wrong df into software) gives you the wrong critical value, and therefore the wrong conclusion about statistical significance. For small samples the difference between, say, df = 9 and df = 10 can shift a p-value across the 0.05 threshold, so it pays to calculate df carefully rather than estimate it.
Related Calculators
- Maths & Statistics Calculators: the full maths and stats hub.
- t-Test Calculator: run the full t-test with your df.
- Chi-Square Calculator: test statistic and p-value.
- ANOVA Calculator: full one-way ANOVA table.
- Standard Deviation Calculator: find s1 and s2 from raw data.
Sources: Standard formulas for the t-distribution, chi-square distribution and one-way ANOVA as presented in introductory statistics texts (e.g. Moore, McCabe and Craig, "Introduction to the Practice of Statistics"). Welch-Satterthwaite equation per Welch (1947), "The generalization of Student's problem when several different population variances are involved," Biometrika.
This calculator provides the standard degrees of freedom formula for each test type. It does not perform the full hypothesis test itself. Confirm which test design (pooled vs Welch, one-way vs factorial ANOVA) matches your study before using the result.