How to use this degrees of freedom calculator
Choose your scenario above (one sample, two samples, a chi-square table, or a correlation), enter the sample sizes (or table dimensions), and press Calculate. The degrees of freedom appear with the formula that produced them.
What "degrees of freedom" actually means
Degrees of freedom counts how many values in a calculation are free to vary once the summary statistics are fixed. Suppose three numbers must average 10. Pick the first two freely, say 8 and 12, and the third is forced: it must be 10 for the mean to hold. Three values, one constraint, two degrees of freedom. That is the whole idea; every formula in this calculator is bookkeeping of the same kind.
A one-sample t-test on 25 students has df = 25 − 1 = 24. A chi-square test on a 3×4 contingency table has df = (3−1)(4−1) = 6. Those single numbers select the row of the t-table or chi-square table you read your critical value from: get the df wrong and every conclusion downstream is wrong with it.
The patterns worth remembering
- n − 1: one sample, one estimated mean (t-tests, sample variance).
- n₁ + n₂ − 2: two independent samples, two means estimated.
- (r − 1)(c − 1): chi-square independence, where row and column totals constrain the table.
- n − 2: correlation and simple regression (a line has two fitted parameters).
Frequently asked questions
Why do we lose a degree of freedom when estimating the mean?
Because the deviations from a sample mean must sum to zero: knowing n − 1 of them determines the last one. That single constraint is the lost degree of freedom.
Where do I use degrees of freedom?
To pick the correct row of a t, chi-square or F table, and inside the formulas for sample variance, ANOVA and regression. Every inferential tool on this site asks for it.
Can degrees of freedom be zero or negative?
Only if the sample is too small for the analysis: n = 1 gives df = 0 for a t-test, which is statistics' way of saying the test is impossible.