Science & Engineering

Degrees of Freedom Calculator (t, Chi-Square, ANOVA)

Degrees of freedom set which distribution your test statistic follows, and the formula changes with the test. Pick your test and enter the sample sizes to get df.

Reviewed and updated

How to use
  1. Choose the test: one-sample t, two-sample t, chi-square, ANOVA, or regression.
  2. Enter the relevant sample sizes or table dimensions.
Common n
Degrees of freedom
24

25 − 1 = 24

For study and estimation. Verify against authoritative data before relying on a result.
Was this helpful?

Degrees of freedom = observations minus estimated parameters

df = observations estimated parameters

Every parameter you estimate from the data (a mean, a group mean, a regression coefficient) removes one value that is free to vary. That is why a one-sample t-test with 25 observations has 24 degrees of freedom: 24 numbers can be anything, but the 25th is pinned down once the mean is fixed.

The formula for each test

TestInputsDegrees of freedom
One-sample tnn − 1
Two-sample tn₁, n₂n₁ + n₂ − 2
Chi-square (r×c table)rows r, columns c(r − 1)(c − 1)
ANOVA, between groupsk groupsk − 1
ANOVA, within groupsk groups, N totalN − k
Linear regressionn samples, p predictorsn − p − 1

A 3×4 chi-square table has (3−1)(4−1) = 6 df. Four ANOVA groups over 80 observations give F(3, 76). Regression subtracts one extra for the intercept.

What the number changes downstream

  • It sets the critical value. A two-tailed t-test at α = 0.05 needs ±2.228 at df = 10, but only ±2.042 at df = 30, and ±1.960 as df approaches infinity (the normal distribution).
  • It shapes the distribution. Fewer degrees of freedom give the t-distribution thicker tails and less certainty; more df pull it toward normal.
  • It narrows confidence intervals. Larger samples mean higher df, a smaller t-multiplier, and a tighter interval for the same data spread.

Common questions

What are degrees of freedom in simple terms?

They are the number of values in a calculation that are free to vary. If five numbers must average to a fixed value, you can pick four freely but the fifth is forced, so you have four degrees of freedom. Estimating a parameter like the mean costs you one.

Why is degrees of freedom usually n minus 1?

Because a one-sample test estimates one thing from the data, the sample mean, and that uses up one degree of freedom. So from n observations you are left with n minus 1 that can vary independently.

Can degrees of freedom be zero or negative?

No. Zero or negative degrees of freedom means you have more constraints than data, which usually signals too many predictors for the sample size. The value must be a positive whole number.

How do degrees of freedom affect the p-value?

They set the shape of the test distribution. The same test statistic gives a larger p-value with fewer degrees of freedom and a smaller one with more, because larger samples produce tighter distributions and lower critical values.

From the blog

Guides & how-tos

All articles →