Scientific Converters Precise unit conversions for science & engineering.

    Loading…

    Chi-Square Test Calculator

    The chi-square test compares observed counts with those expected under independence: the table (20, 30 / 30, 20) gives 4 (df = 1, p = 0.0455).

    Each line is a row of the contingency table; separate columns with spaces or commas.

    χ² =

    4 (df = 1, p = 0.0455)

    p-value
    0.0455003
    Degrees of freedom
    1
    Result at α = 0.05
    Significant: reject independence
    Expected counts E = row total × column total ÷ grand total
    RowColumn 1Column 2
    12525
    22525
    Step-by-step solution
    1. Grand total = 100; expected Eᵢⱼ = (row total × column total) ÷ 100
    2. χ² = Σ (O − E)² ÷ E = 4
    3. df = (rows − 1)(columns − 1) = 1; p = P(χ² ≥ 4) = 0.0455003

    Chi-Square Test Formula

    χ² = Σ (O − E)² ÷ E

    O observed count, E = row total × column total ÷ grand total; df = (r − 1)(c − 1)

    Worked Example

    The 2 × 2 table with rows (20, 30) and (30, 20):

    1. Grand total = 100; expected Eᵢⱼ = (row total × column total) ÷ 100
    2. χ² = Σ (O − E)² ÷ E = 4
    3. df = (rows − 1)(columns − 1) = 1; p = P(χ² ≥ 4) = 0.0455003

    Degrees of freedom: 1 · Result at α = 0.05: Significant: reject independence

    Expected counts E = row total × column total ÷ grand total
    RowColumn 1Column 2
    12525
    22525

    When the chi-square test is valid

    The chi-square test compares observed counts with the counts expected if the variables were independent. It needs raw counts, not percentages, and each expected count should be at least 5; otherwise merge categories or use Fisher’s exact test. Degrees of freedom are (rows − 1) × (columns − 1). A small p-value shows an association but not its strength; Cramér’s V measures that.

    Frequently asked questions

    When can I use the chi-square test?

    For counts (not percentages) of independent observations, with expected counts of at least about 5 in most cells. For small 2 × 2 tables use Fisher’s exact test.

    How do I interpret the p-value?

    If p is below your significance level (usually 0.05), reject the hypothesis that the row and column variables are independent.

    What about Yates’ continuity correction?

    For 2 × 2 tables some textbooks subtract 0.5 from each |O − E| before squaring. This calculator gives the uncorrected Pearson χ², which is what R’s chisq.test(correct = FALSE) reports.

    Sources

    Last reviewed: . Factors are stored exactly and computed with 50-digit decimal arithmetic. See how we verify conversion factors.

    Cite this page

    APA

    Scientific Converters. (2026, October 15). Chi-Square Test Calculator. Retrieved October 25, 2026, from https://scientificconverters.com/calculators/chi-square-calculator/

    IEEE

    Scientific Converters, "Chi-Square Test Calculator," scientificconverters.com. Accessed: Oct. 25, 2026. [Online]. Available: https://scientificconverters.com/calculators/chi-square-calculator/

    Send feedback

    Found a wrong value, a missing unit or an idea? Tell us. We read every message.

    What is it about?

    We store your message, the page you were on and your email if given. See the privacy policy.