StatGardenREF. DESK
Calculators/Statistics/McNemar's test
Statistics

McNemar's test calculator

Tests whether paired binary outcomes changed, using the two discordant-pair counts.

Published 4 August 2026 · Updated 25 September 2026

What this calculator does

McNemar test is for paired binary data: the same subjects measured twice, or matched pairs. It uses only the discordant pairs, those that changed, and ignores everyone whose result stayed the same.

With 10 changing one way and 22 the other, the corrected chi-square is 3.781 with p = 0.0518 and the uncorrected version is 4.500 with p = 0.0339. Those two straddle the conventional threshold, so the choice of correction decides the verdict. That is uncomfortable, and it is the honest situation for a result this marginal.

The formula

Formulaχ² = (b − c)² / (b + c); continuity-corrected χ² = (|b − c| − 1)² / (b + c); df = 1

The statistic is the squared difference between the two discordant counts divided by their sum, on one degree of freedom. The continuity-corrected version subtracts 1 from the absolute difference before squaring, which compensates for approximating a discrete distribution with a continuous one. Concordant pairs, those that did not change, carry no information about change and are excluded.

TermMeaning
Discordant pairsPairs where the two measurements disagree. Only these enter the calculation.
Concordant pairsPairs that agree. They are ignored entirely, which surprises people.
Continuity correctionA downward adjustment for using a continuous distribution on discrete counts.
Paired designThe same subjects measured twice, or subjects matched into pairs.

The inputs explained

FieldWhat to enter
Discordant pairs: positive → negative (b)Pairs that went from positive to negative.
Discordant pairs: negative → positive (c)Pairs that went from negative to positive.

When to use it

Before and after a treatment

The same patients tested twice, where the question is whether the rate changed.

Comparing two tests on the same samples

Where both tests are applied to every sample, the results are paired rather than independent.

Matched case-control studies

Cases matched to controls produce pairs, which must be analysed as pairs.

Worked examples

Every figure in the tables below is produced by this page’s own calculator at build time, so the numbers and the tool always agree. Select any row to load that scenario.

How does the discordant split affect the result?

A range of counts changing in the other direction.

b = 10 fixed
Negative → positive (c)Continuity-corrected χ² (df = 1)p-value (corrected)p-value (uncorrected)
c = 1001.00001.0000
c = 150.64000.42370.3173
c = 223.7810.05180.0339
c = 309.0250.00270.0016
An equal split gives exactly zero and a p-value of 1, as it should when the changes balance. The c = 22 row is the awkward one: corrected p is 0.0518 and uncorrected is 0.0339, sitting either side of 0.05. A result this marginal should be reported as marginal rather than resolved by choosing a correction.

Questions

Why are the concordant pairs ignored?

Because they carry no information about whether a change occurred. A subject negative both times and one positive both times both tell you nothing about the direction of change. Only the pairs that moved can distinguish a real shift from chance.

Should I use the continuity correction?

Opinion is divided. The correction makes the test more conservative and is the traditional default, but many statisticians consider it over-conservative. Where the two disagree, as here, the honest conclusion is that the evidence is borderline rather than that one answer is right.

When should I use McNemar instead of a chi-square test?

Whenever the data is paired. Using an ordinary chi-square test on paired data ignores the pairing, which throws away the design advantage and gives the wrong answer. If the same subjects appear in both columns, McNemar is the correct test.

What if the discordant counts are very small?

Below about 25 discordant pairs in total, the chi-square approximation becomes unreliable and an exact binomial test should be used instead. That test asks directly whether the split between b and c is consistent with a fair coin.

For independent rather than paired proportions, see the two-proportion z-test calculator. For small counts in a 2x2 table, see the Fisher’s exact test calculator.