Observed counts
Enter counts for two categorical variables. Each subject must contribute to one cell, and observations must be independent. Use a 2×2 table or any table with 2–20 rows and columns.
Test results
Null hypothesis: row and column categories are independent. Both tests use a two-sided alternative.
Fisher exact test
Expected count = row total × column total / N. Cells below 5 are highlighted. Small p-values indicate evidence of association, not its size or causality.
Methods & calculation limits
Pearson χ² = Σ (observed − expected)² / expected, with (rows − 1)(columns − 1) degrees of freedom. Its p-value is an asymptotic chi-square upper-tail probability. Sparse expected counts can make this approximation unreliable.
Fisher's two-sided test conditions on both margins and sums the probabilities of all tables no more probable than the observed table. For larger tables this is the Fisher–Freeman–Halton exact test. It uses complete enumeration with log-factorials and log-sum-exp arithmetic.
Exact calculation is limited to N ≤ 100,000, 200,000 search nodes and 100,000 tables. Difficulty depends on margins and dimensions as well as N. If a limit is reached, no Fisher p-value is reported; the Pearson result remains available. No Monte Carlo or hybrid approximation is substituted.
Zero cells are allowed, but empty rows or columns must be removed. The total cannot exceed 1,000,000,000. These tests do not handle paired observations, survey weights or structural zeros (cells that are impossible by design). Counts stay in your browser; URL parameters are visible in the address and browsing history.
References: SciPy chi-square documentation; R Fisher exact documentation.
Planning a study? Use the separate two-proportions sample size and power calculator.