Genetics · Chi-square

Hardy–Weinberg equilibrium and chi-square calculator

Check Hardy–Weinberg equilibrium from genotype counts or allele frequencies and compute the chi-square statistic.

Runs entirely in your browser; no data is uploaded.

How to use (3 steps)

  1. Choose the input mode: genotype counts (AA, Aa, aa) or allele frequencies p, q.
  2. Enter counts or p (and optional sample size N). Default values use a simple teaching example.
  3. Tap Compute to see p, q, expected genotype frequencies, chi-square (Genotype mode), and the steps. In Allele mode only expected frequencies are shown. Copy URL shares the exact setup.

Interpretation: a non-significant χ² means the sample does not show a detectable deviation from Hardy–Weinberg equilibrium at the chosen α.

Inputs

Use observed genotype counts to compute p, q, and χ².

Assume p (and optional N) to see HWE expected frequencies only.

Genotype counts

individuals
individuals
individuals

Results

Chi-square test

df = 1 because p is estimated from the sample.

Visualizations

Observed vs expected counts

Hardy–Weinberg genotype frequencies at this p

How it is calculated

Formulas used: p = (2·AA + Aa)/(2N); q = 1 − p; expected counts: N·p², N·2pq, N·q²; χ² = Σ (O−E)²/E with df = 1.

    Need help interpreting your result? Ask in the comments.

    FAQ

    What is Hardy–Weinberg equilibrium?

    It is an idealized model where allele and genotype frequencies stay constant under assumptions like random mating and no selection, mutation, or migration. This calculator uses that assumption to compute expected frequencies.

    Does a non-significant chi-square prove equilibrium?

    No. It only means the sample does not show a statistically detectable deviation at the chosen α. It does not prove perfect equilibrium.

    What if expected counts are small?

    When expected counts are small, the chi-square approximation weakens. Consider exact tests such as Fisher's exact test for very small counts.

    Related calculators

    Ads

    Comments

    Feedback is welcome. Comments load only after you click.