Author: Minsa A
Last updated: November 22, 2026

Two-Way ANOVA Calculator

Run a two-factor ANOVA on your data and get the complete ANOVA table in seconds: F-statistic, p-value, eta-squared, and partial eta-squared for each main effect and their interaction. Works with any balanced design in your browser — no signup, no software.

Two-Way ANOVA Calculator

Balanced design only. This calculator assumes equal observations per cell. For unequal cell sizes, use statistical software with Type III sums of squares (R: car::Anova(model, type=3) or SPSS General Linear Model).

 Set the number of levels for each factor, then click Build grid. Enter one value per cell (each cell represents a single observation for that combination of factor levels).

What Is a Two-Way ANOVA?

A two-way ANOVA (also called a two-factor ANOVA or factorial ANOVA) tests how two categorical independent variables and their interaction simultaneously affect one continuous dependent variable. Where a one-way ANOVA calculator tests a single null hypothesis, the two-way version tests three at once: one for each factor's main effect and one for the A×B interaction.

That interaction term is what makes the two-way design valuable. Running two separate one-way ANOVAs on the same data misses it entirely and wastes the information available in a factorial experiment. The two-way test is part of the broader toolkit covered in hypothesis testing.

When to Use Two-Way ANOVA

Use two-way ANOVA when… Instead consider…
You have 2 categorical independent variables One-way ANOVA if you have 1 factor
You want to test whether the two factors interact Separate one-way ANOVAs (less efficient; misses interaction)
The dependent variable is continuous Chi-square test if the DV is categorical
Observations are independent Repeated-measures ANOVA if subjects appear in multiple cells
Each factor has 2+ levels, equal n per cell T-test calculator if one factor has exactly 2 levels and you don't need an interaction test

The Three Null Hypotheses

A two-way ANOVA tests all three simultaneously:

H0A: The main effect of Factor A is zero — all row marginal means are equal.
H0B: The main effect of Factor B is zero — all column marginal means are equal.
H0AB: There is no interaction between Factor A and Factor B — the effect of A is the same at every level of B.

Two-Way ANOVA Formula and ANOVA Table

Each F-statistic is computed as MSeffect / MSerror. The error row (also called the within-groups or residual row) is the denominator for all three F-tests. One thing that trips people up: the Total row carries SStotal and dftotal only — it has no MS or F value.

Source SS df MS F
Factor A SSA a − 1 SSA / (a−1) MSA / MSE
Factor B SSB b − 1 SSB / (b−1) MSB / MSE
A × B SSAB (a−1)(b−1) SSAB / [(a−1)(b−1)] MSAB / MSE
Error SSE ab(n−1) SSE / [ab(n−1)] —
Total SST abn − 1 — —

a = number of levels of Factor A  •  b = number of levels of Factor B  •  n = observations per cell (balanced)

Why only the right tail of the F distribution?

F = variancebetween / variancewithin. We reject the null only when the between-group variance is larger than the within-group variance, which produces a large F in the right tail. A low F value means groups are more similar than chance would predict — that is not evidence of a treatment effect. The F distribution starts at zero and extends rightward, so the rejection region sits entirely in the right tail. You can look up the critical F value in the F-distribution table.

Step-by-Step Worked Example

Drug Dosage × Patient Gender on Response Time

Design: 2×2 balanced. Factor A: Drug dosage (Low / High). Factor B: Gender (Male / Female). Dependent variable: Response time (ms). n = 5 observations per cell, N = 20 total.

Raw data by cell:

CellValuesCell mean
Low dose, Male85, 90, 88, 92, 8788.4
Low dose, Female78, 82, 80, 85, 7980.8
High dose, Male72, 75, 74, 70, 7372.8
High dose, Female69, 71, 70, 72, 6870.0

Computed ANOVA table:

Source SS df MS F p
Dosage (A) 2016.20 1 2016.20 93.80 < .001
Gender (B) 338.45 1 338.45 15.74 < .001
Dosage × Gender 51.20 1 51.20 2.38 .140
Error 343.00 16 21.44 — —
Total 2748.85 19 — — —

Interpretation: The interaction is not significant (F = 2.38, p = .140), so we can interpret the main effects directly. Dosage has a significant main effect (F = 93.80, p < .001): high dose produces lower response times overall. Gender also has a significant main effect (F = 15.74, p < .001): females show lower response times overall. Because each factor has only two levels and the interaction is non-significant, no Tukey HSD post-hoc test is needed here.

Load these exact values into the calculator above to reproduce the table and verify the figures.

How to Interpret Two-Way ANOVA Results

1

Check the interaction effect first

This is the most important step. If A×B is significant (p < α), do not interpret the main effects as global statements. The effect of Factor A differs depending on which level of Factor B you're looking at. Run simple main effects analysis instead: test the effect of A at each level of B separately, and apply Bonferroni correction to control the family-wise error rate. Main effects can be numerically significant but deeply misleading when the interaction is significant — a drug that "works overall" may work only for one age group.

2

Interpret main effects (when interaction is not significant)

If the interaction is not significant, main effects are interpretable directly at the marginal mean level. Any main effect with 3 or more levels requires a post-hoc test to identify which specific groups differ. Tukey HSD is the standard choice for balanced designs; see the Tukey HSD table for critical values.

3

Report effect sizes

η² (eta-squared) = SSeffect / SStotal gives each effect's share of total variance. Partial η² = SSeffect / (SSeffect + SSerror) is the standard for publication because it allows cross-study comparison. Cohen's benchmarks for partial η²: small = 0.01, medium = 0.06, large = 0.14. The effect size calculator can confirm these values.

4

Read the interaction plot

An interaction plot places one factor on the x-axis with separate lines for each level of the other factor. Parallel lines indicate no interaction — both factors operate independently. Converging or crossing lines signal an interaction. Crossing lines (a "disordinal" interaction) mean the factors reverse each other's effect at different levels. When an interaction is significant, the plot is the clearest way to communicate what it means.

Post-Hoc Tests After Two-Way ANOVA

Post-hoc tests are needed when a factor with 3 or more levels is significant, or when a significant interaction requires simple main effects analysis.

Test When to use
Tukey HSD Significant main effect with 3+ levels, balanced design, homogeneous variances. Find critical values in the Tukey q table.
Bonferroni correction Simple main effects analysis after a significant interaction; multiply individual p-values by the number of comparisons. Use the Bonferroni calculator.
Games-Howell Main effects or simple effects when cell variances are unequal (heteroscedastic); does not assume equal variances.

Assumptions of Two-Way ANOVA

Two-way ANOVA rests on five assumptions. The fifth in particular can trip researchers up when variances differ between cells.

1. Continuous dependent variable. The DV must be measured on an interval or ratio scale. See statistical test assumptions for guidance on measurement levels.
2. Categorical independent variables. Both factors must be categorical (nominal or ordinal) with two or more discrete levels.
3. Independence of observations. Each participant or unit appears in exactly one cell. Subjects are not measured repeatedly across levels.
4. Approximate normality within each cell. The DV should be roughly normally distributed within each cell of the design. Test this with the Shapiro-Wilk test. With large balanced samples, ANOVA is robust to mild violations of this assumption.
5. Homogeneity of variances across cells. Cell variances should be approximately equal; check with Levene's test. If Levene's test is significant, consider a variance-stabilizing transformation (log, square root) rather than Welch's ANOVA. Welch's correction is well-established for the one-way case but is not standardized for two-way factorial designs and is not widely implemented in statistical software for the factorial case.

Balanced vs. Unbalanced Designs

A balanced design has the same number of observations in every cell. All three types of sums of squares (Type I, II, III) produce identical results, which is why the computations in this calculator are straightforward.

An unbalanced design has unequal cell sizes. Type I SS is order-dependent and inappropriate for this case. You must use Type III SS, which is the default in SPSS (General Linear Model) and available in R via car::Anova(model, type=3). Never apply the formulas in this calculator to unbalanced data.

The same principle extends to interpreting sums of squares: for balanced data the distinction between types doesn't matter; for unbalanced data, using the wrong type produces incorrect F-statistics and p-values for each effect.

Frequently Asked Questions

What is a two-way ANOVA?
A two-way ANOVA (also called two-factor ANOVA or factorial ANOVA) tests how two categorical independent variables and their interaction affect one continuous dependent variable. It produces three F-tests: main effect of Factor A, main effect of Factor B, and the A×B interaction. It is an extension of the one-way ANOVA to experiments with two factors.
What does the interaction effect mean?
An interaction means the effect of one factor depends on which level of the other factor you're looking at. If a drug works for young patients but not older ones, there is an interaction between drug and age group. When an interaction is significant, avoid interpreting main effects in isolation — run simple main effects instead. See the full two-way ANOVA guide for worked examples.
How do I read the two-way ANOVA table?
The table shows Source | SS | df | MS | F | p for Factor A, Factor B, Interaction A×B, and Error rows, plus a Total row. For each effect, F = MSeffect / MSerror. If p < α (usually 0.05), that effect is statistically significant. The Total row contains SStotal and dftotal only — it has no MS or F value.
What are the assumptions of two-way ANOVA?
The five assumptions are: (1) continuous DV; (2) categorical IVs with 2+ levels; (3) independent observations; (4) approximate normality within each cell (Shapiro-Wilk test); (5) homogeneity of variances across cells (Levene's test). With large balanced samples, ANOVA tolerates mild normality violations reasonably well. See the assumptions page for more detail.
What post-hoc tests should I use after a significant two-way ANOVA?
When the interaction is not significant: Tukey HSD (balanced) or Games-Howell (unequal variances) for significant main effects with 3+ levels. When the interaction is significant: run simple main effects analysis and apply Bonferroni correction to control the family-wise error rate.
What is the difference between balanced and unbalanced two-way ANOVA?
Balanced means equal n per cell (this calculator). Unbalanced means unequal cell sizes, which requires Type III sums of squares. Use R with car::Anova(type=3) or SPSS General Linear Model with Type III SS for unbalanced designs.
How is two-way ANOVA different from one-way ANOVA?
The one-way ANOVA tests one factor. Two-way ANOVA tests two factors and their interaction simultaneously, is statistically more efficient, and detects effects that two separate one-way ANOVAs cannot. Use one-way when you have one categorical factor; use two-way when you have two and want to test whether they interact.
What is effect size in two-way ANOVA?
η² = SSeffect / SStotal. Partial η² = SSeffect / (SSeffect + SSerror). For partial η², Cohen's (1988) benchmarks: small = 0.01, medium = 0.06, large = 0.14. Partial η² is preferred for publication because it allows comparisons across studies with different designs.

Related Statistics Resources

References: Cohen, J. (1988). Statistical power analysis for the behavioral sciences (2nd ed.). Lawrence Erlbaum. • Field, A. (2018). Discovering statistics using IBM SPSS Statistics (5th ed.). Sage. • Montgomery, D. C. (2017). Design and analysis of experiments (9th ed.). Wiley.