Hardy-Weinberg Calculator
Calculate allele and genotype frequencies in a population using the Hardy-Weinberg equilibrium principle.
Hardy-Weinberg Analysis
p² + 2pq + q² = 0.3600 + 0.4800 + 0.1600 = 1.000000
Genotype Frequencies & Counts
About Hardy-Weinberg Equilibrium
The Hardy-Weinberg principle states that allele and genotype frequencies remain constant in a population across generations in the absence of evolutionary forces. The equation p² + 2pq + q² = 1 describes genotype frequencies, where p = dominant allele frequency and q = recessive allele frequency (p + q = 1).
What the Hardy-Weinberg Calculator Does
The Hardy-Weinberg calculator turns a single allele frequency into a complete picture of a population's genetic makeup. Given one piece of information about a gene with two alleles, it predicts the expected proportion of every genotype and the absolute number of individuals carrying each one. This is the workhorse model of population genetics, and it underpins everything from carrier screening in human medicine to conservation planning for endangered species.
The Hardy-Weinberg principle, named after mathematician G.H. Hardy and physician Wilhelm Weinberg who independently described it in 1908, states that allele and genotype frequencies stay constant from generation to generation when a population is not evolving. In other words, the gene pool reaches a stable equilibrium that acts as a null hypothesis. If real-world genotype counts match the predicted Hardy-Weinberg frequencies, no evolutionary force is detectably acting on that locus; if they deviate, something like selection, migration, or non-random mating may be at work.
This calculator handles three common starting points. You can enter the dominant allele frequency (p) directly, enter the recessive allele frequency (q) directly, or supply the count of individuals showing the recessive phenotype and let the tool back-calculate the allele frequencies. Whichever mode you choose, it reports p, q, the three genotype frequencies, individual counts scaled to your population size, and the total number of dominant and recessive alleles in the gene pool. The equilibrium check line confirms that p² + 2pq + q² sums to 1.
The Hardy-Weinberg Equations
Two linked equations describe a Hardy-Weinberg population. The first deals with allele frequencies and the second with genotype frequencies. For a single gene with one dominant allele (A) and one recessive allele (a), the frequency of A is p and the frequency of a is q.
Because every allele copy at the locus must be either A or a, the two frequencies must add to one: p + q = 1. The genotype equation is the binomial expansion of that sum squared, which gives the proportions of the three possible diploid genotypes:
- p² = frequency of homozygous dominant individuals (AA)
- 2pq = frequency of heterozygous individuals (Aa)
- q² = frequency of homozygous recessive individuals (aa)
When you start from the recessive phenotype count, the calculator reverses the logic. The recessive phenotype only appears in aa individuals, so its frequency equals q². Taking the square root recovers q, and p follows as 1 - q. Multiplying each genotype frequency by the population size N gives the expected number of individuals in each category, and counting allele copies (two per diploid individual) gives the total dominant and recessive alleles in the gene pool.
Hardy-Weinberg Genotype Distribution
Where:
- p= Frequency of the dominant allele A (0 to 1)
- q= Frequency of the recessive allele a; q = 1 - p
- p²= Expected frequency of homozygous dominant genotype AA
- 2pq= Expected frequency of heterozygous genotype Aa
- q²= Expected frequency of homozygous recessive genotype aa
- N= Population size; multiply each frequency by N for individual counts
How to Use the Calculator
Start by choosing a calculation mode that matches the data you have. Each mode needs only one genetic input plus an optional population size.
- From dominant allele frequency (p): Enter p as a decimal between 0 and 1. The tool sets q = 1 - p, then expands the squared sum to produce all genotype frequencies.
- From recessive allele frequency (q): Enter q directly. The tool sets p = 1 - q and proceeds identically. This mode is handy when you already know the rare allele's frequency from a database.
- From recessive phenotype count: Enter how many individuals display the recessive trait, plus the total population size. The tool computes q² = count ÷ N, takes the square root to find q, then derives p.
The population size field (default 1,000) scales frequencies into real counts. If you only care about proportions, the default is fine; if you are modeling a specific sample, enter its true size. Results update instantly. The output panel shows the equilibrium check (p² + 2pq + q² should equal 1.000000), the allele frequencies p and q, total dominant and recessive allele copies, and a per-genotype breakdown of AA, Aa, and aa with both percentages and individual counts.
One important caveat the tool cannot detect for you: the recessive-count mode only works if the recessive phenotype is fully expressed in homozygotes. If the trait shows incomplete penetrance or if heterozygotes are sometimes affected, the square-root estimate of q will be biased.
Reading and Interpreting the Results
The most useful number for many genetics problems is the heterozygote frequency, 2pq. For recessive genetic disorders, heterozygotes are unaffected carriers, so 2pq estimates the fraction of healthy people silently carrying one copy of the disease allele. A classic surprise is that even for a rare disorder, carriers vastly outnumber affected individuals. The table below shows how genotype proportions shift as the recessive allele becomes rarer.
| q (recessive allele) | p² (AA) | 2pq (Aa carriers) | q² (aa affected) | Carriers per affected |
|---|---|---|---|---|
| 0.50 | 0.2500 | 0.5000 | 0.2500 | 2.0 |
| 0.10 | 0.8100 | 0.1800 | 0.0100 | 18.0 |
| 0.01 | 0.9801 | 0.0198 | 0.0001 | 198.0 |
Notice that when q = 0.01, only 1 in 10,000 people are affected, yet nearly 2 in 100 are carriers. This is why screening programs target carriers, not just patients. The calculator's allele-count outputs are equally informative for conservation genetics: comparing observed heterozygosity against the expected 2pq value flags inbreeding or recent population bottlenecks long before they become obvious in phenotypes.
The Five Hardy-Weinberg Assumptions
Hardy-Weinberg equilibrium is an idealized model. It holds exactly only when five conditions are met simultaneously. Each violated assumption corresponds to a recognized mechanism of evolution, which is precisely why deviations from the predicted frequencies are biologically interesting.
- No mutation: Allele frequencies are not altered by new mutations converting one allele into another.
- No gene flow (migration): No individuals enter or leave the population carrying different allele frequencies.
- No natural selection: All genotypes have equal survival and reproductive success, so none is favored.
- Random mating: Mates pair without regard to genotype at the locus in question, so allele combinations follow chance alone.
- Infinitely large population: The population is large enough that random sampling error (genetic drift) does not shift frequencies between generations.
No real population satisfies every assumption perfectly, yet many loci sit remarkably close to equilibrium because the deviations are small or balance out. Geneticists use a chi-square goodness-of-fit test to decide whether observed genotype counts differ significantly from the calculator's Hardy-Weinberg predictions. A significant deviation is a clue worth chasing, and a non-significant result confirms the locus behaves as a sensible neutral baseline.
Where Hardy-Weinberg Is Applied
The Hardy-Weinberg framework appears across biology, medicine, and forensics. In human genetics, it estimates carrier frequencies for autosomal recessive disorders such as cystic fibrosis, sickle cell anemia, and phenylketonuria, guiding the design of population screening programs. In conservation biology, comparing observed and expected heterozygosity helps detect inbreeding and loss of genetic diversity in small or fragmented populations. In forensic science, the same equations convert allele frequencies in reference databases into the random-match probability of a DNA profile.
The model is also a teaching cornerstone. Introductory genetics courses and exams such as AP Biology routinely ask students to compute carrier frequencies from a recessive phenotype count, which is exactly the recessive-count mode of this calculator. Beyond a single locus, the same binomial logic extends to genome-wide association studies, where checking each marker for Hardy-Weinberg equilibrium is a standard quality-control filter that flags genotyping errors. Whether you are estimating disease risk, auditing a SNP array, or solving a textbook problem, this allele frequency calculator gives the expected genotype distribution in one step.
Worked Examples
From dominant allele frequency p = 0.6
Problem:
A gene has a dominant allele frequency p = 0.6 in a population of 1,000 individuals. Find the genotype frequencies and counts.
Solution Steps:
- 1Set q = 1 - p = 1 - 0.6 = 0.4 (frequencies must sum to 1).
- 2Compute genotype frequencies: p² = 0.36, 2pq = 2 × 0.6 × 0.4 = 0.48, q² = 0.16.
- 3Scale to N = 1,000: AA = 0.36 × 1000 = 360, Aa = 0.48 × 1000 = 480, aa = 0.16 × 1000 = 160.
- 4Count alleles: dominant = 2(360) + 480 = 1,200; recessive = 2(160) + 480 = 800.
Result:
p = 0.6, q = 0.4. Genotypes: 360 AA, 480 Aa, 160 aa. Gene pool: 1,200 dominant and 800 recessive alleles.
From recessive phenotype count (160 of 1,000)
Problem:
In a sample of 1,000 individuals, 160 show the recessive phenotype. Estimate the allele and genotype frequencies.
Solution Steps:
- 1The recessive phenotype equals q², so q² = 160 ÷ 1000 = 0.16.
- 2Take the square root: q = √0.16 = 0.4000, then p = 1 - q = 0.6000.
- 3Genotype frequencies: p² = 0.3600, 2pq = 0.4800, q² = 0.1600.
- 4Counts at N = 1,000: AA = 360, Aa = 480, aa = 160 (matching the 160 observed).
Result:
q = 0.4000, p = 0.6000. Expected genotypes: 360 AA, 480 Aa, 160 aa.
From recessive allele frequency q = 0.3
Problem:
A recessive allele has frequency q = 0.3 in a population of 500. Predict the carrier frequency and counts.
Solution Steps:
- 1Set p = 1 - q = 1 - 0.3 = 0.7.
- 2Genotype frequencies: p² = 0.49, 2pq = 2 × 0.7 × 0.3 = 0.42, q² = 0.09.
- 3Scale to N = 500: AA = 0.49 × 500 = 245, Aa = 0.42 × 500 = 210, aa = 0.09 × 500 = 45.
- 4Allele copies: dominant = 2(245) + 210 = 700; recessive = 2(45) + 210 = 300.
Result:
p = 0.7, q = 0.3. Genotypes: 245 AA, 210 Aa (carriers), 45 aa. Gene pool: 700 dominant and 300 recessive alleles.
Tips & Best Practices
- ✓Allele frequencies p and q must each fall between 0 and 1 and always sum to exactly 1.
- ✓Use the recessive phenotype count mode for the common exam problem of finding carrier frequency from affected individuals.
- ✓Heterozygote (Aa) carriers are the 2pq term and usually far outnumber affected aa individuals for rare alleles.
- ✓Only take the square root of q² when the recessive phenotype is fully penetrant in homozygotes.
- ✓Set the population size to your real sample size when you need individual counts rather than proportions.
- ✓Confirm the equilibrium check line reads 1.000000 to verify your inputs are consistent.
- ✓To test for evolution, follow up with a chi-square test comparing observed versus these expected counts.
- ✓Remember that p², 2pq, and q² are the AA, Aa, and aa genotype frequencies in that order.
Frequently Asked Questions
Sources & References
Last updated: 2026-06-05
Help us improve!
How would you rate the Hardy-Weinberg Calculator?
Editorial Note
MyCalcBuddy Editorial Team
This page is maintained as an educational calculator reference.
Formula Source: Standard Mathematical References
by Various