🧮
🧮 Math & statistics

McNemar's Test Calculator (paired 2×2 table: χ² and exact p)

Results update as you type.

Your numbers

Understanding the McNemar's test calculator — concept and principle

This calculator runs McNemar's test on a paired 2 × 2 table, for example the same people answering yes or no before and after a campaign, or two diagnostic tests on the same patients. It gives the χ² statistic and p-value, the continuity-corrected version, the exact binomial p-value, the number of discordant pairs and the yes-proportions at both times, and says which p-value to use.

McNemar's testOnly the pairs that changed countsecond: yessecond: nofirst: yes4518first: no631b + c24yes rate63 % → 51 %χ² = (18 − 6)² ÷ 24 = 6 · p = 0.01431
People who answered the same both times carry no information about change.

How it is calculated

χ² = (b − c)² ÷ (b + c), compared with the chi-square distribution with 1 degree of freedom

With continuity correction: (|b − c| − 1)² ÷ (b + c)

Exact version: b is binomial with n = b + c and p = 0.5

The principle

In paired data, people who answered the same way both times (a and d) say nothing about change. Only the discordant pairs matter: b changed from yes to no and c from no to yes. If nothing changed systematically, a discordant pair is equally likely to be of either kind, like a fair coin, so b and c should be about equal. The test measures how lopsided the split between b and c is.

Worked example

Default inputs: a = 45, b = 18, c = 6, d = 31 (N = 100).

  1. Proportion yes at first = (45 + 18) ÷ 100 = 63 %; at second = (45 + 6) ÷ 100 = 51 %.
  2. Discordant pairs b + c = 24.
  3. χ² = (18 − 6)² ÷ 24 = 144 ÷ 24 = 6, p = 0.01431.
  4. With continuity correction: (12 − 1)² ÷ 24 = 5.042, p = 0.02474; exact binomial p = 0.02266.
  5. Which p-value to use: b + c > 20: the χ² p-value is fine.

How to read the result

All three p-values are below 0.05, so the drop from 63 % to 51 % yes is unlikely to be chance alone. The direction comes from b and c: 18 people switched from yes to no and only 6 the other way. Report the change in proportions with a confidence interval alongside the p-value.

Common mistakes

Keep in mind: The test only checks whether the proportions differ. It does not show why, and before–after studies without a control group cannot separate the effect of an intervention from other changes over time.

Frequently asked questions

When is McNemar's test used?

For paired yes/no data, such as before-and-after measurements on the same people.

Why are only b and c used?

Pairs that answered the same way both times carry no information about change.

When should I use the exact p-value?

When the number of discordant pairs b + c is small, typically 20 or fewer.

Sources: NIST Dataplot Reference Manual, "McNEMAR TEST" · W. J. Conover (1999), Practical Nonparametric Statistics, 3rd ed., Wiley

Checked 9 Nov 2026. NIST Dataplot Reference Manual, “McNEMAR TEST” (T₁ = (b − c)² ÷ (b + c) against χ² with 1 degree of freedom when b + c > 20, continuity-corrected (|b − c| − 1)² ÷ (b + c), and the binomial version T₂ = b with p = 0.5, n = b + c for b + c ≤ 20; after Conover 1999, Practical Nonparametric Statistics, 3rd ed.).

🧮 All math & statistics tools →🌍 Calculators by country →