Hardy-Weinberg Equilibrium Calculator
Calculate allele and genotype frequencies under the Hardy-Weinberg equilibrium model. Enter allele frequency p and/or q, or use a recessive phenotype frequency to estimate p, q, p², 2pq, q², and expected carrier frequency.
Hardy-Weinberg Equilibrium Calculator
Use this calculator to estimate expected allele and genotype frequencies for a two-allele population under Hardy-Weinberg assumptions. You can enter p, q, or a recessive phenotype frequency.
Hardy-Weinberg Calculation Result
Step-by-Step Calculation
What Is Hardy-Weinberg Equilibrium?
Hardy-Weinberg equilibrium is a population-genetics model that describes the relationship between allele frequencies and expected genotype frequencies when specified assumptions are met. For a gene with two alleles, the model uses allele frequencies p and q and predicts genotype frequencies p², 2pq, and q².
What Does This Calculator Calculate?
This calculator determines allele frequencies and expected genotype frequencies under the Hardy-Weinberg model. It can start with p, q, or a recessive phenotype frequency interpreted as q².
It also reports the expected heterozygous frequency, often called the carrier frequency when the heterozygous genotype represents a carrier state for a recessive allele, and can estimate expected genotype counts when a population size is supplied.
Hardy-Weinberg Equations
p + q = 1
Genotype frequencies
p² + 2pq + q² = 1
AA = p²
Aa = 2pq
aa = q²Here, p is the frequency of one allele and q is the frequency of the alternative allele at the same locus.
Worked Example: p = 0.7 and q = 0.3
If p = 0.70 and q = 0.30:
- p² = 0.70² = 0.49 or 49%
- 2pq = 2 × 0.70 × 0.30 = 0.42 or 42%
- q² = 0.30² = 0.09 or 9%
The genotype frequencies sum to 0.49 + 0.42 + 0.09 = 1.00.
Using Recessive Phenotype Frequency
If a recessive phenotype is assumed to correspond to the homozygous recessive genotype aa, its frequency is q². The recessive allele frequency can therefore be estimated as:
q = √q²p = 1 − qFor example, if the recessive phenotype frequency is 0.09, q = √0.09 = 0.30 and p = 0.70.
What Is a Carrier Frequency?
For a simple autosomal recessive model, heterozygous individuals have genotype Aa and expected frequency 2pq. If Aa represents a carrier state for a particular recessive condition, 2pq is the expected carrier frequency under the model.
The term carrier should not be applied automatically to every heterozygous genotype; it depends on the biological trait and inheritance pattern.
Allele Frequency vs. Genotype Frequency
| Measure | Meaning | Hardy-Weinberg expression |
|---|---|---|
| p | Frequency of allele A | p |
| q | Frequency of allele a | q |
| AA | Homozygous A genotype | p² |
| Aa | Heterozygous genotype | 2pq |
| aa | Homozygous a genotype | q² |
Hardy-Weinberg Assumptions
The equilibrium model is based on assumptions including a very large population, random mating, no migration, no mutation, no natural selection, and no other forces that systematically alter allele frequencies.
Real populations often violate one or more of these assumptions. Hardy-Weinberg equilibrium is therefore commonly used as a reference model rather than a description that every natural population exactly satisfies.
Why the Genotype Frequencies Sum to 1
The expression p² + 2pq + q² is the expansion of (p + q)². Because p + q = 1, the genotype frequencies must sum to 1 under the model:
(p + q)² = p² + 2pq + q² = 1Expected Genotype Counts
If a population size N is supplied, expected counts can be estimated by multiplying each genotype frequency by N:
Expected AA count = N × p²Expected Aa count = N × 2pqExpected aa count = N × q²These are expected counts from the model, not guaranteed observed counts.
Common Mistakes
- Confusing allele frequency with genotype frequency.
- Using q² as q without taking the square root.
- Forgetting that p + q must equal 1 for a two-allele locus.
- Entering percentages such as 30 instead of proportions such as 0.30.
- Calling every heterozygote a carrier regardless of the biological trait.
- Assuming Hardy-Weinberg equilibrium automatically applies to every population.
- Treating expected genotype counts as exact observed counts.
Percentage vs. Proportion
The calculator accepts frequencies as proportions between 0 and 1. Convert percentages before entering them: 70% becomes 0.70, 30% becomes 0.30, and 9% becomes 0.09.
When Should You Use This Calculator?
Use it to explore expected allele and genotype frequencies for a two-allele locus under Hardy-Weinberg assumptions, to convert a recessive phenotype frequency into allele frequency, or to estimate expected genotype counts from a population size.
When Hardy-Weinberg Calculations Need Caution
Inference from phenotype frequency can be misleading when penetrance is incomplete, phenocopies occur, multiple genes affect the trait, the inheritance pattern is not simple autosomal recessive, or the population is structured rather than randomly mating.
For real genetic conditions, population-specific data and appropriate statistical or genetic models may be required.
Accuracy and Limitations
The calculations themselves are mathematical and deterministic. The main limitation is model validity: Hardy-Weinberg equations describe expected frequencies only under their stated assumptions.
The calculator does not test whether an observed population is actually in Hardy-Weinberg equilibrium. A formal equilibrium test may require observed genotype counts and a statistical test such as a chi-square analysis.
How to Use the Calculator
- Enter p, q, or a recessive phenotype frequency.
- If using q², enter the recessive phenotype frequency as a proportion between 0 and 1.
- Optionally enter population size to estimate genotype counts.
- Select Calculate.
- Review p, q, p², 2pq, q², and the equilibrium check.
Calculation Methodology
The calculator first determines allele frequencies. If p is provided alone, q is calculated as 1 − p. If q is provided alone, p is calculated as 1 − q. If a recessive phenotype frequency q² is supplied, q is estimated as √q² and p as 1 − q.
It then calculates p², 2pq, and q² and verifies that p + q and p² + 2pq + q² equal approximately 1 within normal floating-point rounding.
Calculation methodology reviewed: The calculator applies the standard two-allele Hardy-Weinberg equations and clearly distinguishes allele frequencies from expected genotype frequencies. Recessive-phenotype inference is treated as q² only under the stated model assumptions.
Frequently Asked Questions
What is the Hardy-Weinberg equation?
For two alleles, p + q = 1 and p² + 2pq + q² = 1. The terms represent allele and expected genotype frequencies.
What does p represent?
p represents the frequency of one allele at a two-allele locus.
What does q represent?
q represents the frequency of the alternative allele at the same locus.
What does 2pq represent?
2pq is the expected heterozygous genotype frequency under Hardy-Weinberg equilibrium.
How do I calculate q from a recessive phenotype frequency?
If the recessive phenotype corresponds to aa, its frequency is q², so q is the square root of that frequency.
What is the carrier frequency?
For a simple autosomal recessive model in which Aa is a carrier state, the expected carrier frequency is 2pq.
Do p and q have to add to 1?
Yes, for a two-allele locus where p and q represent the complete allele frequencies, p + q = 1.
Does Hardy-Weinberg equilibrium apply to every population?
No. It is a model based on assumptions such as random mating, large population size, and absence of systematic forces that change allele frequencies.
Can I test Hardy-Weinberg equilibrium with this calculator?
No. This calculator estimates expected frequencies. A formal observed-versus-expected equilibrium test requires observed genotype counts and an appropriate statistical method.
Can this calculator be used for clinical genetic risk?
No. It is an educational population-genetics calculator and does not replace condition-specific genetic counseling or risk assessment.
Scientific References
NCBI Bookshelf — Population Genetics
Reference material covering population genetics, allele frequencies, and Hardy-Weinberg concepts.
NHGRI — Genetics Glossary
Definitions and background for genetics and inheritance terminology.
OpenStax Biology 2e
Biology textbook reference covering population genetics and Hardy-Weinberg equilibrium.
NCBI Bookshelf — Population Genetics Concepts
Background on allele frequencies and population-level genetic analysis.
Related Calculators
Disclaimer
This calculator is an educational population-genetics tool. It does not provide clinical genetic diagnosis, personalized medical advice, or condition-specific genetic risk. Real populations and genetic conditions can involve mechanisms that are not represented by the simplified Hardy-Weinberg model.
