hardy weinberg calculator

Hardy-Weinberg Equilibrium Calculator

Use this tool to estimate allele frequencies (p and q), expected genotype frequencies, and a quick chi-square check for equilibrium.

Method 1: Enter genotype counts


Method 2: Enter allele frequency

If you enter p, the calculator uses q = 1 - p and computes , 2pq, and .

What is the Hardy-Weinberg principle?

The Hardy-Weinberg principle is a foundational concept in population genetics. It describes how allele frequencies and genotype frequencies behave in an ideal population where no evolutionary forces are acting.

For a gene with two alleles, A and a, if allele frequencies are p and q, then:

  • p + q = 1
  • AA = p²
  • Aa = 2pq
  • aa = q²
  • p² + 2pq + q² = 1

This relationship helps you compare observed data to expected values and evaluate whether a population may be evolving.

How to use this hardy weinberg calculator

Option 1: Start with genotype counts

Enter the number of individuals with each genotype (AA, Aa, aa). The calculator will estimate:

  • Total population size
  • Allele frequencies (p and q)
  • Observed genotype frequencies
  • Expected genotype frequencies under Hardy-Weinberg equilibrium
  • Expected genotype counts
  • Chi-square statistic for a basic equilibrium check

Option 2: Start with allele frequency p

If you already know p, enter it directly. The calculator will compute q = 1 - p, then return expected genotype frequencies. If you provide a population size, it will also estimate expected counts.

Worked example

Suppose you sampled 100 individuals and observed:

  • AA = 36
  • Aa = 48
  • aa = 16

First, compute allele frequencies:

  • p = (2×AA + Aa) / (2N) = (72 + 48) / 200 = 0.60
  • q = 1 - p = 0.40

Then expected frequencies are:

  • AA expected: p² = 0.36
  • Aa expected: 2pq = 0.48
  • aa expected: q² = 0.16

Here, observed and expected values match exactly, which is consistent with Hardy-Weinberg equilibrium.

Assumptions behind Hardy-Weinberg equilibrium

The model assumes:

  • Very large population size (minimal genetic drift)
  • Random mating
  • No selection
  • No mutation
  • No migration (gene flow)

Real populations often violate one or more assumptions, so Hardy-Weinberg is best used as a baseline model rather than a perfect description of nature.

Interpreting the chi-square result

This calculator includes a simple chi-square statistic comparing observed and expected genotype counts. For a quick screening at significance level 0.05 with 1 degree of freedom, the common threshold is approximately 3.84.

A chi-square value below 3.84 suggests no strong evidence against equilibrium (for this simplified test). A value above 3.84 suggests a potential deviation. Always interpret results with biological context and proper sampling design.

Why this tool is useful

A fast hardy weinberg calculator is useful in genetics classes, exam review, and preliminary analysis of population data. It helps connect raw genotype counts to core concepts like allele frequency, heterozygosity, and equilibrium testing in one place.

🔗 Related Calculators