Degrees of Freedom Calculator
This degrees of freedom calculator will help you determine this crucial variable for onesample and twosample ttests, chisquare tests, and ANOVA. Read the text to find out:
 What degree of freedom is (degrees of freedom definition);
 How to find degrees of freedom; and
 The degrees of freedom formula.
What are degrees of freedom? Definition
Let's start with a definition of degrees of freedom:
Degrees of freedom indicates the number of independent pieces of information used to calculate a statistic; in other words – they are the number of values that are able to be changed in a data set.
That may sound too theoretical, so let's take a look at an example:
Imagine we have two numbers: x
, y
, and the mean of those numbers: m
. In this data set of three variables, how many degrees of freedom do we have? The answer is 2. Why? Because 2 is the number of values that can change. If you choose the values of any two variables, the third one is already determined. Look:

If
x
equals2
andy
equals4
, you can't pick any mean you like; it's already determined:m = (x + y) / 2
m = (2 + 4) / 2
m = 3
. 
If you assign
3
tox
and6
tom
, theny
's value is "automatically" set – it's not free to change, because:m = (x + y) / 2
6 = (3 + y) / 2
12 = 3 + y
12  3 = y
y = 9
Any time you assign some two values, the third has no "freedom to change", hence there are two degrees of freedom in our scenario.
Now that we know what degrees of freedom are, let's learn how to find df.
How to find degrees of freedom – formulas
The formula for degrees of freedom depends on the type of statistical test you're performing. Below, you'll see equations for the most popular ones:

1sample ttest:
$\textrm{df} = N  1$,
where:

$df$ – Degrees of freedom; and

$N$ – Total number of subjects/values.


2sample ttest (samples with equal variances):
$\textrm{df} = N_1 + N_2  2$,
where:

$N_1$ – Number of values from the first sample; and

$N_2$ – Number of values from the second sample.


2sample ttest with unequal variances (Welch’s ttest):
In this case, we calculate an approximation of the degrees of freedom:
where $\rm Var$ – Variance.
✅ As you can see, the number of values in samples heavily influences the number of degrees of freedom. Learn more with our sample size calculator. Or, if you just wish to perform a ttest quickly and without worrying about df, use Omni's ttest calculator – it will take care of everything!

ANOVA:

Degrees of freedom between groups:
$\textrm{df}_{\rm between} = k  1$,
where $k$ – Number of groups or cell means.

Degrees of freedom within groups:
$\textrm{df}_{\rm within} = N  k$

Total degrees of freedom:
$\textrm{df}_{\rm total} = N  1$


Chisquared test of independence
$\textrm{df} = (\textrm{rows}  1) \cdot (\textrm{columns}  1)$
You can discover more about computing χ²
with our dedicated chi squared calculator.
If you're wondering how to find $\rm df$ quickly – use our degrees of freedom calculator. It includes all of the above formulas.
Degrees of freedom calculator
This is how to use the df calculator:

Choose the statistical test you're using.

Enter the variables which will appear in the rows below, e.g. the sample size.

You'll find the result in the last box of the df calculator.
FAQ
How to calculate degrees of freedom for ttest?
To calculate degrees of freedom of a 1sample ttest:

Determine the size of your sample (N).

Subtract 1.

The result is the number of degrees of freedom.
How to calculate degrees of freedom for chisquare?
To calculate degrees of freedom for the chisquare test, use the following formula:
df = (rows  1) × (columns  1)
,
that is:

Count the number of rows in the chisquare table and subtract one.

Count the number of columns and subtract one.

Multiply the number from step 1 by the number from step 2.
How to calculate degrees of freedom for twosample ttest?
To calculate degrees of freedom for twosample ttest, use the following formula:
df = N₁ + N₂  2,
that is:

Determine the sizes of your two samples.

Add them up.

Add 2 to the result from the previous step.
How to calculate degrees of freedom for ANOVA?
To calculate degrees of freedom for ANOVA:

Subtract 1 from the number of groups to find degrees of freedom between groups.

Subtract the number of groups from the total number of subjects to find degrees of freedom within groups.

Subtract 1 from the total number of subjects (values) to find total degrees of freedom.
Can degrees of freedom be 0?
Yes, theoretically degrees of freedom can equal 0. It would mean there's one piece of data with no "freedom" to vary and no unknown variables. However, in practice, you shouldn't have 0 degrees of freedom when performing statistical tests.