Skip to content

Hardy–Weinberg Calculator

Explore allele balance. Compare observed and expected genotypes.

Two alleles · Diploid autosomal model · Population-level estimates

Population & Inputs

Observed genotype counts

Whole-number counts from one diploid, biallelic locus.

100 individualsTotal sample size (N)
200 allele copiesTotal alleles (2N)

Allele balance (estimated from counts)

p (A) = 0.6400q (a) = 0.3600

A and a are allele labels, not frequency rankings.

Small expected counts? Prefer an exact test.

Model assumptions & sampling notes

Use representative genotype counts from unrelated diploid individuals at an autosomal biallelic locus. HWE assumes random mating and negligible selection, migration and mutation in a sufficiently large population. Structure, genotyping error, relatedness and ascertainment can affect a test. Expected counts below 5 warn against the χ² approximation; larger counts alone do not guarantee validity.

Example values shown. Replace them with your data.

Result

Estimated allele frequencies

p = 0.6400q = 0.3600

From observed genotypes · p + q = 1

Expected genotype frequencies (HWE)

40.96%AA · p²
46.08%Aa · 2pq
12.96%aa · q²

Expected genotype frequencies under HWE.

Equilibrium test

χ² = 9.336P-value = 0.00225

df = 1 · α = 0.05

Evidence of departure from HWE

This result does not identify its cause.

Minimum expected count: 12.96

Heterozygosity & test definition

Ho = 0.3200 · He = 0.4608 · F = 1 − Ho/He = 0.3056. F is a descriptive sample deficit/excess, not proof of individual inbreeding.

The exact HWE test conditions on observed allele counts and sums configurations no more probable than the observed one. It is two-sided and probability-ordered, with no mid-P adjustment. It is not Fisher’s 2×2 test. Pearson χ² uses df = 1 because one allele frequency is estimated from the sample. A monomorphic sample is not informative for this comparison.

Observed vs Expected Genotypes

GenotypeObserved nExpected nObserved %Expected %χ² contribution
AA—————
Aa—————
aa—————
Total100100.00100.00%100.00%9.336

Expected counts remain fractional; values are rounded for display.

Genotype Distribution

ObservedExpected (HWE)
0255075100

Observed and expected percentages of individuals.

Allele balance

p (A) = 0.6400q (a) = 0.3600

From alleles to a population

Stylized AA, Aa and aa allele tokens on three display stands; not anatomical chromosome models

Conceptual genotype symbols; not chromosome anatomy or a sampled population image.

Explore Recessive Carrier Frequency

Separate illustrative example · Carrier Estimate mode

Inheritance model
Autosomal recessive
q = 0.0200 · 2pq = 3.92% carriers (≈1 in 25.5)

Assumes HWE and matching population prevalence; not an individual diagnosis.

This simplified example also assumes full penetrance and an effectively biallelic model. Different populations, multiple disease-causing alleles or incomplete penetrance can invalidate prevalence-based estimates.

Understanding the model

The Hardy–Weinberg principle describes genotype frequencies in a population under certain assumptions.

p + q = 1
p² + 2pq + q² = 1

Assumptions (at the modeled locus)

  • Random mating.
  • Sufficiently large population.
  • Negligible selection, migration and mutation.

A nonsignificant test does not prove equilibrium. A significant result does not identify why the sample differs from expectations.

Frequently asked questions

Why use df = 1?

For three genotypes, the total count imposes one constraint and estimating one allele frequency from the same counts uses another parameter: 3 − 1 − 1 = 1 degree of freedom. This implementation tests only observed counts with internally estimated allele frequencies.

When is an exact test preferable?

The χ² approximation can be unreliable with sparse expected counts or rare alleles, even when total N looks large. The two-sided exact test conditions on allele counts. Here, an expected count below 5 triggers a reminder. The browser exact calculation is limited to 200,000 minor-allele copies; larger datasets should use dedicated genetics software.

Can this predict an individual’s disease risk?

No. Carrier frequency is a population-level model based on the supplied prevalence and assumptions. Individual risk depends on genotype, family history, ancestry, variant interpretation and other factors. Discuss clinical questions with a qualified genetics professional.

Does a low P-value prove selection or mutation?

No. Genotyping error, population structure, relatedness, nonrandom sampling and other departures from assumptions can produce a signal. A single test does not identify a mechanism or demonstrate changes over time.

Why are expected counts fractional?

They are model expectations, not observed people. Multiplying N by p², 2pq and q² naturally produces fractional values. Statistics use unrounded expectations, and the table rounds only for display.

Can allele frequencies alone test equilibrium?

No. Allele frequencies generate theoretical genotype expectations. Testing requires observed genotypes and an appropriate sampling design. This calculator does not invent observations from expected values.

What happens at p = 0 or p = 1?

Only one allele is present in the sample or model. HWE expectations remain defined, but the sample contains no informative one-degree-of-freedom genotype comparison. A conditional exact P-value of 1 in a monomorphic sample does not verify equilibrium.

Are my sample data saved?

This module does not store or send sample labels or counts to a server. Copy and Download create a timestamped report only when requested. The separate carrier example is explicitly labeled and is not merged into the main sample analysis.

About this calculator

Hardy–Weinberg proportions assume random mating and the absence of major evolutionary forces. Observed populations may deviate.

Sources & References

↗ Biology

Calculate expected genotype frequencies from an allele frequency under Hardy–Weinberg equilibrium.

Page information

Updated: October 11, 2026