Two-Way ANOVA Calculator

StatisticsLast updated: August 22, 2026

A two-way (two-factor) ANOVA examines how a dependent variable changes across two categorical factors in a single analysis. The difference produced by each factor on its own is called a main effect; the unexpected pattern the two factors create together is called an interaction effect. If, for example, a teaching method works differently in morning and evening sessions, only the interaction term reveals it.

From data entered one observation per line in the form "A level; B level; value", this calculator partitions the total sum of squares into A, B, A×B, and error components, and reports the degrees of freedom, mean square, F, p-value, critical F, and partial eta squared for every effect. It produces a cell-means table together with an interaction line plot, and checks up front whether the design is balanced (an equal number of observations in every cell).

Separate the fields with semicolons (or tabs). The design must be balanced: every A×B cell must contain the same number of observations, and at least 2.
Sets the false positive risk. In the social sciences 5% is the common choice.

Two-Way ANOVA Formulas (balanced design)

SS_total = ΣΣΣ (xᵢⱼₖ − x̄)²                     df = abn − 1
SS_A  = b·n · Σᵢ (x̄ᵢ.. − x̄)²                   df = a − 1
SS_B  = a·n · Σⱼ (x̄.ⱼ. − x̄)²                   df = b − 1
SS_AB = n · ΣᵢΣⱼ (x̄ᵢⱼ. − x̄ᵢ.. − x̄.ⱼ. + x̄)²     df = (a−1)(b−1)
SS_error = ΣΣΣ (xᵢⱼₖ − x̄ᵢⱼ.)²                  df = ab(n − 1)
MS = SS / df    ,    F_effect = MS_effect / MS_error
Partial η² = SS_effect / (SS_effect + SS_error)

a is the number of levels of factor A, b the number of levels of factor B, and n the number of observations per cell. In a balanced design the four sums of squares add up exactly to the total SS; in an unbalanced design the factors become confounded (Type I, II, and III sums of squares give different results), which is why this calculator requires a balanced design. All three effects use the same error term (MS_error) as the denominator.

How to Calculate

  1. Write each observation on its own line as "A level; B level; value", separating the fields with semicolons.
  2. Enter the factor names — they are used in the results table, the plots, and the interpretation.
  3. Make sure the design is balanced: every A×B cell must hold the same number of observations, and at least 2; otherwise the calculator returns a clear error.
  4. Read the interaction row of the ANOVA table first: if it is significant, do not interpret the main effects on their own.
  5. Look at the interaction line plot; parallel lines mean no interaction, while crossing or diverging lines mean there is one.
  6. Report the partial eta squared values, and after a significant effect examine the cell means with Bonferroni-corrected comparisons.

Worked Examples

Method × Session — a strong interaction

The cell means are 85.50 for digital-evening, 79.00 for digital-morning, 72.50 for classic-morning, and 68.50 for classic-evening. The Method main effect is very strong at F(1, 12) = 112.322; p < 0.001 (ηp² = 0.903), while the Session main effect is not significant at F(1, 12) = 1.271; p = 0.282. The interaction, however, is significant at F(1, 12) = 22.424; p < 0.001 (ηp² = 0.651): the classic method works better in the morning and the digital method in the evening.

Yöntem × Oturum interaction — F: 22.424 · Interaction — p-value: p < 0.001 · Interaction — partial eta squared (ηp²): 0.651

Fertilizer × Irrigation — main effects only

The cell means of 21.00, 27.00, 31.00, and 37.00 form a perfectly additive pattern. The Fertilizer main effect is F(1, 8) = 300.000; p < 0.001 and the Irrigation main effect is F(1, 8) = 108.000; p < 0.001, while the interaction is entirely absent at F(1, 8) = 0.000; p = 1.000. The two lines in the interaction plot are exactly parallel, so the main effects can be interpreted directly.

Gübre × Sulama interaction — F: 0.000 · Interaction — p-value: p = 1.000 · Interaction — partial eta squared (ηp²): 0.000

A 3 × 2 design with no significant effects

This 3 × 2 design of three groups and two sexes has 3 observations per cell, N = 18 in total. The Group main effect is F(2, 12) = 0.224; p = 0.802, the Sex main effect is F(1, 12) = 0.017; p = 0.898, and the interaction is F(2, 12) = 0.328; p = 0.727 — no effect is significant. The grand mean is 50.389 and every cell mean is squeezed between 50.00 and 51.00.

Grup × Cinsiyet interaction — F: 0.328 · Interaction — p-value: p = 0.727 · Interaction — partial eta squared (ηp²): 0.052

Frequently Asked Questions

If the interaction is significant, why should I not interpret the main effects?
A main effect is the effect of one factor averaged over all levels of the other factor. When an interaction is present, that average can be an artificial value that occurs in no subgroup at all: if the effect is positive at one level and negative at another, the average lands near zero and creates the impression of 'no effect'. The correct approach is then to examine the simple effects: compare A separately within each level of B.
My design is not balanced — what should I do?
In an unbalanced design the factors become confounded and the sum-of-squares decomposition is no longer unique; Type I, Type II, and Type III sums of squares produce different F and p values. This calculator deliberately handles only balanced designs and returns a clear error otherwise. For unbalanced data, use the Univariate GLM procedure in SPSS (Type III by default) or the Anova(model, type = 3) call from the car package in R.
What is the difference between partial eta squared and eta squared?
Eta squared divides the sum of squares of an effect by the TOTAL sum of squares, so the eta squared values of all effects cannot add up to more than 1. Partial eta squared puts only the effect itself and the error term in the denominator (SS_effect / (SS_effect + SS_error)), so it is unaffected by the presence of the other factors. SPSS reports partial eta squared by default; these values are not additive and are noticeably larger than eta squared in multifactor designs.
What are the assumptions of a two-way ANOVA?
Observations must be independent, the dependent variable must be approximately normally distributed within each cell, and the cell variances must be homogeneous. In a balanced design ANOVA is quite robust to violations of variance homogeneity, which is one of the strongest practical reasons to build a balanced design. Homogeneity of variance is checked with Levene's test and normality with a Q-Q plot of the residuals.
How should I read the interaction plot?
The cell means are plotted with the levels of one factor on the horizontal axis and one line per level of the other factor. Parallel lines mean there is no interaction: the effect of one factor is the same at every level of the other. Lines that converge or diverge indicate an ordinal interaction that preserves the ordering, while crossing lines indicate a disordinal interaction that reverses it. The plot gives a clue, but the decision rests on the F and p values.
How many observations do I need per cell?
At least 2 observations per cell are required for the error term to be computable; with a single observation per cell the interaction cannot be tested because it is confounded with the error term. In practice 10–15 observations per cell are targeted for adequate power; detecting a medium-sized effect in a 2 × 2 design with 80% power usually requires around 25 observations per cell. With small cells, a non-significant result may reflect low power rather than the absence of an effect.
How do I get the same result in SPSS, R, and Excel?
In SPSS, go to Analyze → General Linear Model → Univariate and define the dependent variable and two fixed factors; for a balanced design the output matches this calculator exactly. In R, summary(aov(value ~ A * B)) gives the same ANOVA table. In Excel, use the 'Anova: Two-Factor With Replication' tool in the Data Analysis add-in; the data must be arranged in blocks with the levels of A in rows and the levels of B in columns.