statcompute

Hypothesis tests

Levene's Test Calculator

Check whether several groups have the same spread — the assumption that the pooled t-test and classic ANOVA both rely on.

Also called levene test calculator, test for equal variances, homogeneity of variance calculator.

Updated August 2026Runs in your browser — nothing is uploadedVerified against R
One group per line, or separate groups with a blank line. A word at the start of a line names that group.
The median version is far more robust to non-normal data and is what car::leveneTest uses by default.
Conventionally 0.05. Decide before you look at the data.

The calculation runs in your browser, so this box needs JavaScript. The formula, the worked example and the interpretation below do not.

01

How to read this result

A small p-value means the spreads differ. That is the opposite of the usual reading: here you are hoping not to reject, because the null hypothesis — equal variances — is the assumption you want to be able to make.

But do not treat it as a gate. With a large sample this test rejects on differences in spread far too small to affect a t-test; with a small sample it misses differences that matter. Modern practice is to use Welch's t-test and Welch's ANOVA as the default and skip the pre-test entirely — they cost almost nothing when the variances are equal and rescue the analysis when they are not.

The variance ratio is the number to look at. As a rough guide, a largest-to-smallest variance ratio under about 4 is tolerable for a pooled test with equal group sizes, and much less tolerable when the group sizes differ. Unequal variances combined with unequal group sizes is the case where the pooled test goes genuinely wrong: if the smaller group has the larger variance the p-value is too small, and if it has the smaller variance the p-value is too large.

Why deviations, not variances? Levene's test replaces every value with its distance from its group's centre, then runs an ordinary ANOVA on those distances. If one group is more spread out, its distances are systematically larger — and comparing means of distances is something ANOVA already knows how to do.

02

The formula

W=(Nk)(k1)ini(Z¯iZ¯)2ij(ZijZ¯i)2
Zij
|x_{ij} - \tilde{x}_i| — the distance of each value from its group's centre
Z¯i
the mean of those distances within group i
Z¯
the overall mean distance
k,N
the number of groups and the total sample size

W follows an F distribution with k − 1 and N − k degrees of freedom. Using the median as the centre gives the Brown-Forsythe variant, which is the default here.

03

Worked example

Do three treatment groups have comparable spread?

The same three groups from the ANOVA example. Their means clearly differ — but ANOVA's classic F also assumes their variances are alike, and this is the test of that assumption.

A: 23, 25, 21, 24, 22 · B: 28, 30, 27, 29, 31 · C: 25, 24, 26, 23, 27

  1. Find each group's median.
    A: 23 B: 29 C: 25
  2. Replace every value with its absolute distance from its own group's median.
    A: 0, 2, 2, 1, 1 B: 1, 1, 2, 0, 2 C: 0, 1, 1, 2, 2
  3. Take the mean distance in each group.
    1.2, 1.2, 1.2
  4. Run a one-way ANOVA on those distances. The group means of the distances are identical, so the between-group sum of squares is zero.
    SS between = 0
  5. W is therefore zero and p is 1 — no evidence whatever of unequal spread.
    W = 0, p = 1
W 0.000df 2, 12p 1.000Conclusion no evidence against equal variances

A perfectly clean result like this is rare and is a consequence of the example's tidy numbers — all three groups happen to have identical spread. It does make the mechanics easy to follow: Levene's test is nothing more than ANOVA applied to distances.

Checked against a one-way ANOVA on the median-centred absolute deviations, computed in R.

The calculator above is loaded with these numbers by the Load the worked example button.

04

Assumptions, and when to use something else

Levene's test assumes independent observations and that the groups' distributions differ only in spread and location. It is much less sensitive to non-normality than the older Bartlett's test, which is why it displaced it — and the median-centred (Brown-Forsythe) version is less sensitive still, which is why it is the default here.

Two limits worth stating plainly:

  • Power depends on sample size, not on importance. A non-significant result from small groups is weak reassurance, and a significant result from large ones may be a difference too small to affect anything.
  • It tests variances, not distributions. Two groups can pass this test and still differ in shape in ways that matter for a t-test.
  • The variances differ and you are comparing two meansWelch's t-testUntick “assume equal variances” — Welch's test handles unequal spread directly.
  • The variances differ and you are comparing three or more meansWelch's ANOVAThe ANOVA calculator reports Welch's version alongside the classic F for exactly this case.
  • You want to check normality insteadShapiro-Wilk testThe other assumption behind t and ANOVA, tested the same way — as evidence rather than as a gate.
05

Questions people ask

Levene's test or Bartlett's test?

Levene's, in almost every case. Bartlett's test is more powerful when the data really are normal and badly unreliable when they are not — it rejects on non-normality rather than on unequal variance. Levene's, especially the median-centred version, keeps its nominal error rate on skewed and heavy-tailed data.

What does a significant Levene's test mean for my ANOVA?

That the classic equal-variance F is not trustworthy, particularly if the group sizes also differ. Use Welch's ANOVA instead — the ANOVA calculator reports it for every run — or a rank-based test such as Kruskal-Wallis.

Should I always test for equal variances first?

Increasingly, no. Choosing which test to run based on a preliminary test of assumptions is itself a data-dependent decision, and it distorts the error rate of whatever you run next. The simpler and better-behaved policy is to use Welch's versions by default and treat Levene's test as a description of the data rather than a switch.

Why is the median version called Brown-Forsythe?

Because Brown and Forsythe proposed centring on the median (and on the trimmed mean) in 1974 as a robustification of Levene's 1960 mean-centred statistic. Confusingly, 'Brown-Forsythe' also names a different test — an unequal-variance alternative to ANOVA. Software labels are inconsistent; the calculator above states exactly which centre it used.