How to calculate
With margins fixed, enumerate the possible tables using hypergeometric probabilities. A two-sided result adds the probabilities of all tables no more likely than the observed one.
Worked example
Use Row 1 column 1 1 · Row 1 column 2 9 · Row 2 column 1 11 · Row 2 column 2 3 · Alternative hypothesis Two sided · Significance level 5%. The result is ≈ 0.275945618522008346%.
Input and result notes
The percentage result is the p-value written as a percentage. The test conditions on the row and column totals.