Want a Custom tool for Yourself?

Need a Custom Tool? We build custom tools that can save hours per employee per day.

Degrees Of Freedom Calculator

Get degrees of freedom for common tests like t tests, chi square, and ANOVA. Choose the test type and enter sample sizes to compute df.

Enter the Details

Test type:

Sample size (N):


Result will appear here...


Last updated: April 11, 2026

Created by: Eon Tools Dev Team

Reviewed by: Ankit Khatiwada



What the degrees of freedom calculator does

Degrees of freedom count how many values in a calculation are truly free to vary. They set the exact shape of the t, chi-square, and F distributions, so getting them right is what makes a p-value correct. This calculator works them out for the common tests: one-sample and two-sample t-tests, chi-square, and analysis of variance.

They are a number people plug in without always knowing what it means. Below is how it works and what degrees of freedom really are.

How to use it

  1. Choose the test type from the list.
  2. Enter what it asks for: a sample size, two sample sizes and their variances, the rows and columns of a table, or the number of groups.
  3. Press Calculate for the degrees of freedom, or Reset to clear it.

What degrees of freedom actually are

Here is the idea in plain terms. Suppose five numbers must average to 10, so their total is fixed at 50. You can choose the first four freely, but once you have, the fifth is forced, whatever it takes to reach 50. Four of the five were free to vary, so there are four degrees of freedom.

That is why so many formulas involve the sample size minus one. Working out a statistic usually pins down something, like the mean, and each thing pinned down costs one degree of freedom. What remains is the amount of independent information left, which is exactly what the degrees of freedom count.

The formulas for each test

For a one-sample t-test, the degrees of freedom are the sample size minus one. For a two-sample test with equal variances, they are the two sample sizes added together minus two, one lost for each mean. With unequal variances, the calculator uses the Welch formula, which blends the two sample sizes and variances into an adjusted, often non-whole, figure.

For a chi-square test on a table, the degrees of freedom are the number of rows minus one times the number of columns minus one. For analysis of variance, there are two: between groups, the number of groups minus one, and within groups, the total size minus the number of groups. The calculator applies whichever formula fits the test you pick.

A worked example

Suppose you run a one-sample t-test on a sample of 25 values. The degrees of freedom are 25 minus 1 = 24.

For a two-sample test with equal variances on groups of 15 and 15, they would be 15 plus 15 minus 2 = 28. And for a chi-square test on a table with 3 rows and 4 columns, they would be (3 minus 1) times (4 minus 1) = 6. Each test has its own rule, but all of them are counting the same thing: the independent information available.

Why degrees of freedom matter

Degrees of freedom are not busywork. The t-distribution, the chi-square, and the F all change shape depending on them. With few degrees of freedom the t-distribution has heavy tails, demanding a larger statistic before a result counts as significant; with many, it tightens toward the normal curve.

So the same test statistic can give a different p-value depending on the degrees of freedom, which is why they have to be right. Feed a p-value calculator the wrong degrees of freedom and the significance it reports will be off, even if the statistic itself is perfect.

Questions people ask

What are degrees of freedom?

The number of values in a calculation that are free to vary. They measure the independent information available and set the shape of the t, chi-square, and F distributions.

Why is it often the sample size minus one?

Because calculating a statistic like the mean fixes one quantity, leaving one fewer value free to vary. Each thing estimated costs one degree of freedom.

Why is the unequal-variance value not a whole number?

Because the Welch formula blends the two samples' sizes and variances, which usually produces a fractional result. That is normal and expected for that test.

Why do they matter for a p-value?

Because the test distributions change shape with the degrees of freedom, the same statistic gives different p-values for different values. The right figure is needed for the right answer.

References

A quick note on where the methods here come from. Degrees of freedom for t-tests, chi-square tests, and analysis of variance are set out in the NIST/SEMATECH e-Handbook of Statistical Methods, the US government's public statistics reference. OpenStax Introductory Statistics is a free, widely used textbook covering degrees of freedom.

  1. NIST/SEMATECH e-Handbook of Statistical Methods (t-tests, chi-square, and analysis of variance). https://www.itl.nist.gov/div898/handbook/
  2. OpenStax, Introductory Statistics (degrees of freedom and the t-distribution). https://openstax.org/details/books/introductory-statistics-2e


Ankit Khatiwada

Ankit Khatiwada is a researcher and graduate student in Computer Science at Saarland University, with strengths in statistics, data analysis, data engineering, and full stack development. His work sits at the intersection of quantitative reasoning and applied technology, making him a strong fit for tools that depend on clear numerical logic. At Eon Tools, he reviews number and statistical tools.