Skip to content
ENExplore Calculators

Contingency Table Calculator

Work out contingency table instantly with clear inputs, formula shown and shareable results.

About Contingency Table Calculator

A two-by-two contingency table cross-tabulates two binary variables. Comparing each cell with its expected count under independence gives a chi-square statistic on one degree of freedom, and phi rescales it as a correlation.

Formulas

Expected count

E = row total × column total / grand total

Phi coefficient

φ = √(χ² / N)

Worked example

With the default values below, Contingency Table Calculator returns Chi-square statistic (1 df) of 16.66666667. Change any input above and every figure here is recalculated in your browser.

Inputs used

Cell a (row 1, column 1)minimum 0
40
Cell b (row 1, column 2)minimum 0
10
Cell c (row 2, column 1)minimum 0
20
Cell d (row 2, column 2)minimum 0
30

Results

Chi-square statistic (1 df)
16.66666667
p value
0.00004456
Phi coefficient (effect size)
0.40824829
Grand total
100

Step by step

  1. 1Values used
  2. 2Expected count
  3. 3Phi coefficient
  4. 4Chi-square statistic (1 df)= 16.66666667
  5. 5p value= 0.00004456
  6. 6Phi coefficient (effect size)= 0.40824829
  7. 7Grand total= 100

Assumptions and limits

  • The result is derived only from the 4 inputs listed above. Anything not among them is not part of the calculation.
  • In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
  • Figures are rounded for display to 8 decimal places, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.

How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.

Frequently Asked Questions

For the table 40, 10, 20, 30?

The expected counts are 30, 20, 30 and 20, so χ² = 100/30 + 100/20 + 100/30 + 100/20 ≈ 16.667 on 1 df, giving p ≈ 0.00004 and a phi of 0.4082.

When should I use Fisher's exact test?

When any expected count falls below about 5, where the chi-square approximation becomes unreliable.

Contingency Table Calculator | Calcrivo