Degrees of Freedom Calculator

Use this free degrees of freedom calculator to find df for one-sample t-tests, two-sample t-tests, chi-square goodness-of-fit, and chi-square independence tests. Select the test type, enter sample sizes, and get the degrees of freedom with the formula used.

Enter Values

Choose the statistical test to compute df for

Required for all tests

For two-sample t-test only

For chi-square goodness-of-fit only

For chi-square independence only

For chi-square independence only

Result

Enter values above and click Calculate to see your result.

AI Assistant

Ask about this calculator

I can help you understand the degrees of freedom calculator formula, interpret your results, and answer follow-up questions.

Try asking

Formula

#
Core Formula
One-sample t: df = n - 1Two-sample t: df = n1 + n2 - 2Chi-square GoF: df = k - 1Chi-square Independence: df = (r - 1)(c - 1)

How it works: Degrees of freedom represent the number of independent values free to vary. Each test has a specific formula based on sample sizes and constraints.

Review and Methodology

Updated Mar 26, 2026

This calculator runs locally in your browser. Inputs are converted into the units required by the formula, and the result is paired with supporting references so you can verify the method before using it for planning or estimates.

Worked Example

Test: One-sample t-test, n = 20
1Step 1: df = n - 1 = 20 - 1 = 19
2Step 2: For alpha = 0.05 (two-tailed), critical t = approximately 2.093
Result: df = 19.

What Are Degrees of Freedom?

Degrees of freedom (df) is a fundamental concept that determines which probability distribution to use for hypothesis testing. It represents the number of values free to vary after constraints are applied.

  • More df means the distribution is closer to normal (t with df = 100 is nearly identical to z)
  • Fewer df means heavier tails and a larger test statistic needed for significance
  • One-sample t: estimate one parameter (mean), so df = n - 1
  • Two-sample pooled t: estimate from pooled variance, so df = n1 + n2 - 2
  • Chi-square GoF: k categories minus 1 constraint, so df = k - 1
  • Chi-square independence: df = (r - 1)(c - 1) because row and column totals are fixed

Getting df right is essential for accurate p-values. Wrong df leads to wrong conclusions.

You can also calculate changes using our T-Test Calculator, Chi-Square Calculator, F-Test Calculator or Z-Test Calculator.

Frequently Asked Questions

Why do degrees of freedom matter?

They determine the shape of the distribution used for significance testing. Wrong df gives wrong p-values and potentially wrong conclusions.

Why is df = n - 1 for a one-sample t-test?

When computing sample standard deviation using the mean, the deviations must sum to zero. This constraint means only n - 1 values are free to vary.

What is df for a paired t-test?

For n pairs, df = n - 1 (same as one-sample). You compute differences for each pair, reducing to a one-sample problem.

How do df affect the critical value?

Fewer df means wider distribution and larger critical value. df = 5: critical t = 2.571. df = 30: critical t = 2.042. df = infinity: z = 1.960.

What about Welch's t-test df?

Welch's uses a complex formula producing non-integer df based on both sample sizes and variances. This calculator covers the simpler pooled case.

Is it possible to embed the Degrees of Freedom Calculator on another website?

Yes, embedding the Degrees of Freedom Calculator is free. Hit the "Embed" button on this page, adjust the width, height, and theme, then grab the iframe code. It works on WordPress, Wix, Squarespace, Shopify, and plain HTML pages. No registration needed. Full instructions at calculory.com/services/embed-calculators.

Accurate and Reliable

All calculations run locally. Trusted statistical analysis with step-by-step breakdowns.

Verified Precision

Precise Statistical Calculations Powered by Calculory AI