Degrees of Freedom (DF) Calculator
Use this calculator to find degrees of freedom for common statistical tests.
What is a DF calculator?
A DF calculator helps you quickly compute degrees of freedom, a core concept in statistics. Degrees of freedom determine which probability distribution to use (like t, chi-square, or F) and directly affect p-values, confidence intervals, and hypothesis-testing decisions.
If you run statistical tests often, manually computing df every time is slow and error-prone. This tool gives fast results for common methods and reminds you of each formula.
Why degrees of freedom matter
Degrees of freedom are essentially the number of independent pieces of information available after estimating model parameters. In plain language: every parameter you estimate uses up some flexibility in your data.
- Smaller df usually means more uncertainty and wider confidence intervals.
- Larger df generally makes test distributions closer to the normal distribution.
- Using the wrong df can produce incorrect p-values and misleading conclusions.
Common DF formulas included in this calculator
1) One-sample or paired t-test
Use this when testing a single sample mean or mean difference (paired data). The formula is:
df = n - 1
2) Two-sample t-test (equal variances)
If you assume both populations have the same variance (pooled t-test), use:
df = n₁ + n₂ - 2
3) Welch's t-test (unequal variances)
Welch's test is often preferred when variances differ. Its df is not necessarily an integer and is calculated with the Welch–Satterthwaite approximation.
4) Chi-square test for contingency tables
For an r × c table:
df = (r - 1)(c - 1)
5) Linear regression residual degrees of freedom
In a model with n observations and k predictors:
Residual df = n - k - 1
How to use this calculator correctly
- Select the method that matches your statistical test.
- Enter sample sizes and any required values (such as standard deviations for Welch).
- Click Calculate DF.
- Use the result in your test statistic lookup, software verification, or reporting.
Tip: if you're unsure between pooled and Welch two-sample t-tests, Welch is usually safer unless you have a strong reason to assume equal variances.
Worked mini examples
Example A: One-sample t-test
Suppose n = 18. Then:
df = 18 - 1 = 17
Example B: Two-sample pooled t-test
Suppose n₁ = 25 and n₂ = 31.
df = 25 + 31 - 2 = 54
Example C: Chi-square test
For a 3 × 5 contingency table:
df = (3 - 1)(5 - 1) = 8
Frequently asked questions
Is df always an integer?
Not always. For Welch's t-test, df is often fractional. Most software uses that fractional value directly.
Can df be negative?
In valid test setups, no. If you get a negative value, your sample size is too small for the number of estimated parameters.
Does a bigger sample always increase df?
Usually yes, as long as model complexity (number of parameters) stays fixed.
Final thoughts
A good df calculator is simple, but it supports better statistical decisions. Whether you're doing a t-test in class, validating software output, or writing a research report, accurate degrees of freedom keep your inference on track.
Use the tool above whenever you need a quick, reliable df value.