Home › Calculators › Hardy-Weinberg Equilibrium Calculator

Hardy-Weinberg Equilibrium Calculator

Work out allele frequencies p and q, the expected genotype frequencies p², 2pq and q², and test whether a sample is in Hardy-Weinberg equilibrium with a chi-square test. Start from observed genotype counts, a known allele frequency, or the share of the population showing the recessive trait.

Last updated:

What do you know?

dominant / recessive shown as A / a

%

1 in 2,500 = 0.04%

to show expected numbers of individuals

Enter your values to see the result.
Advertisement
Advertisement

How to use the Hardy-Weinberg Equilibrium Calculator

  1. Choose what you know: genotype counts, one allele frequency, or the percentage with the recessive phenotype.
  2. Enter your numbers, e.g. 360 AA, 480 Aa and 160 aa, or q² = 4%.
  3. Pick a significance level for the chi-square test (0.05 is standard).
  4. Press Calculate to see p, q, the expected genotype frequencies and, for counts, the χ² test result.
  5. Read the step-by-step working and download the observed vs expected table as CSV.

Hardy-Weinberg formulas at a glance

QuantityFormulaMeaning
Allele frequenciesp + q = 1p = share of A alleles, q = share of a alleles
Genotype frequenciesp² + 2pq + q² = 1AA, Aa and aa in an equilibrium population
p from counts(2·AA + Aa) / 2Ncount alleles, not individuals
q from a recessive traitq = √(aa frequency)only valid if the population is in equilibrium
Carriers2pqheterozygotes who carry one recessive allele
Chi-squareΣ (O − E)² / E, df = 1critical value 3.841 at α = 0.05

Recessive trait frequency vs carrier frequency

A useful pattern: when a recessive allele is rare, carriers far outnumber affected individuals, because 2pq is much larger than q². The table below uses the equilibrium formulas.

Affected (q²)qpCarriers (2pq)Carriers per affected
25% (1 in 4)0.50.550% (1 in 2)2
16% (1 in 6.25)0.40.648%3
4% (1 in 25)0.20.832%8
1% (1 in 100)0.10.918% (1 in 5.6)18
0.04% (1 in 2,500)0.020.983.92% (1 in 25.5)98
0.01% (1 in 10,000)0.010.991.98% (1 in 50.5)198

Interpreting the chi-square result

  • p-value ≥ α: the observed counts are consistent with Hardy-Weinberg proportions. This does not prove equilibrium, it only means the sample gives no evidence against it.
  • p-value < α: the genotype counts deviate from p², 2pq, q². Look at which class is off: too few heterozygotes suggests inbreeding, population substructure (the Wahlund effect) or allele dropout in genotyping; too many can point to heterozygote advantage or mixing of two source populations.
  • Small samples: if any expected count is below 5 the chi-square approximation is weak. Collect more data or use an exact test.
  • More than two alleles: the same idea extends to (p + q + r)² = 1, but this calculator handles the common two-allele case.

Frequently asked questions

What is the Hardy-Weinberg equation?

For a gene with two alleles at frequencies p and q (p + q = 1), a population in equilibrium has genotype frequencies p² (AA), 2pq (Aa) and q² (aa), and p² + 2pq + q² = 1. The proportions stay the same from generation to generation when no evolutionary forces act.

How do you calculate p and q from genotype counts?

Count alleles: each AA individual carries two A alleles and each Aa carries one. p = (2 × AA + Aa) / (2 × N) and q = (2 × aa + Aa) / (2 × N), where N is the total number of individuals. With 360 AA, 480 Aa and 160 aa, p = (720 + 480) / 2000 = 0.6 and q = 0.4.

How do I find carrier frequency from the number of affected people?

If a recessive condition affects 1 in 2,500 people, q² = 0.0004, so q = √0.0004 = 0.02 and p = 0.98. Carriers (heterozygotes) make up 2pq = 2 × 0.98 × 0.02 ≈ 0.039, or about 1 in 26. Enter 0.04% in the recessive phenotype mode to get this.

How does the chi-square test for Hardy-Weinberg work?

The calculator estimates p from your sample, computes the expected counts p²N, 2pqN and q²N, and adds up (observed − expected)² / expected for the three genotypes. There is 1 degree of freedom (3 classes minus 1, minus 1 for the estimated allele frequency). At α = 0.05 the critical value is 3.841; a larger χ² means the sample deviates from equilibrium.

What are the assumptions of Hardy-Weinberg equilibrium?

A very large population, random mating, no mutation, no migration (gene flow) and no natural selection. Real populations rarely meet every condition, which is why a significant deviation is a useful signal that one of these forces, or a sampling or genotyping problem, is at work.

Can I use Hardy-Weinberg if I only know the dominant phenotype?

Not directly, because AA and Aa look the same. Use the recessive phenotype instead: its frequency equals q², so q = √(recessive frequency). If you know the dominant share, subtract it from 100% to get the recessive share.

What does the inbreeding coefficient F mean here?

F = 1 − (observed heterozygosity / expected heterozygosity). A value near 0 fits random mating, a positive F means fewer heterozygotes than expected (as with inbreeding or population substructure), and a negative F means an excess of heterozygotes.

Are all the tools on FreeToolCabin tested for quality and accuracy?

Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

Related tools

Punnett Square CalculatorBuild monohybrid, dihybrid or trihybrid Punnett squares with genotype and phenotype ratios.Chi-Square CalculatorChi-square goodness-of-fit and independence tests with p-value and expected counts.Population Growth CalculatorExponential or logistic population growth over time with carrying capacity, table and chart.Probability CalculatorFind and, or, not, conditional and at-least-once probabilities from P(A) and P(B).Molar Mass CalculatorMolar mass of any chemical formula with an element-by-element mass % breakdown.Interactive Periodic TableAll 118 elements with colour modes, filters, search and full element details.Chemical Equation BalancerBalance chemical, ionic and redox equations with the matrix method and steps.Molarity CalculatorSolve mass, volume, molarity or molar mass, and C1V1 = C2V2 dilutions with units.pH CalculatorConvert pH, pOH, [H+] and [OH-], or find the pH of strong and weak acids and bases.Dilution CalculatorSolve C1V1 = C2V2 for any variable: stock volume, final volume or concentration, with units.Percent Yield CalculatorPercent yield from actual and theoretical yield, or theoretical yield from moles and formulas.PPM CalculatorConvert ppm to mg/L, %, ppb and mg/kg, find ppm of a solution, or ppm to mg/m³ for gases.Grams to Moles CalculatorConvert grams to moles and back from a chemical formula, with molar mass and atom counts.Blood Type CalculatorPossible child blood types and their odds from both parents' ABO and Rh types, with Punnett squares.Buffer pH CalculatorBuffer pH from pKa and acid/base concentrations, or the recipe for a target pH.Combined Gas Law CalculatorSolve P1V1/T1 = P2V2/T2 for any variable, with Boyle's, Charles's and Gay-Lussac's modes.Electron Configuration CalculatorFull and noble-gas shorthand electron configuration, orbital diagram and valence electrons.Empirical Formula CalculatorElement percentages or grams to mole ratios, empirical formula and molecular formula.Gibbs Free Energy CalculatorΔG from ΔH, ΔS and temperature, with spontaneity, crossover temperature and K.Mass Percent CalculatorMass percent of a solution, percent composition of a formula, or mass for a target %.Molality CalculatorMolality from grams or moles of solute and solvent mass, or solve for either one.Moles to Atoms CalculatorConvert moles, grams and atoms or molecules with Avogadro's number, atoms per element.Protons Neutrons Electrons CalculatorCount protons, neutrons and electrons for any element, isotope or ion, with isotope notation.Serial Dilution CalculatorConcentration, transfer and diluent volume for every tube of a dilution series.Soap Lye CalculatorNaOH or KOH and water for a soap recipe from oil SAP values, superfat and water ratio.Theoretical Yield CalculatorTheoretical yield in grams and moles from limiting reagent mass and mole ratio.Titration CalculatorAnalyte concentration or equivalence volume from a titration, with pH curve and indicator.Stoichiometry CalculatorFrom one known mass or mole amount, get moles and grams of every reactant and product.Six Sigma CalculatorDPMO, yield and sigma level from defects, with the 1.5 sigma shift and a conversion table.Beer-Lambert Law CalculatorSolve A = εlc for absorbance, concentration, molar absorptivity or path length; %T conversion.Boyle's Law CalculatorSolve P1V1 = P2V2 for any missing pressure or volume, with units, gauge option and steps.Centrifuge RPM to RCF CalculatorConvert centrifuge RPM to RCF (× g) or RCF to RPM from rotor radius, with an RPM chart.Charles's Law CalculatorSolve V1/T1 = V2/T2 for volume or temperature, with °C, °F or K converted to kelvin.Normality CalculatorFind normality from mass or molarity, and how much solid or stock acid makes an N solution.Oxidation Number CalculatorEnter a formula or ion to get the oxidation state of every element, with the rules used.Percent Solution CalculatorHow much solute and solvent for a w/v, w/w or v/v % solution, plus % from amounts and dilutions.Valence Electrons CalculatorValence electrons for any element, ion or molecule formula, with group-by-group working.
See all 35 Chemistry & Biology Calculators →