Hardy-Weinberg Equilibrium Calculator
Enter one known frequency — q², p², p, q or the dominant phenotype — and get p, q, p², 2pq, q², carrier odds and expected carriers for a population size.
Hardy-Weinberg Equilibrium Calculator
Background.
Why doesn't a harmful recessive allele disappear once the people who inherit two copies stop passing it on? Hardy–Weinberg arithmetic answers that. If a recessive condition affects one person in 10,000, the allele frequency q is the square root of 0.0001, which is 0.01. Carriers, at 2pq, make up 0.0198 of the population — about 1 person in 51 — so for every affected person there are close to 200 carriers who show nothing. Ninety-nine per cent of the allele's copies sit in heterozygotes, out of reach of any selection acting on the visible trait.
The calculation can start from whichever single frequency you have: the recessive phenotype (q²), the homozygous dominant genotype (p²), either allele frequency, or the dominant phenotype (p² + 2pq). From it the calculator rebuilds p and q, the three genotype frequencies, the share of unaffected people who are carriers, carrier odds, and the expected number of carriers in a population of whatever size you enter.
Every one of those numbers relies on the proportions p², 2pq and q² actually holding, and they hold only under idealised conditions: a very large population, mating that is random with respect to the gene, and no selection, mutation or migration shifting allele frequencies. Real populations bend these rules constantly, which is why Hardy–Weinberg gets used in two opposite ways. As a model, it turns an observed incidence into carrier estimates. As a null hypothesis, it is the benchmark that real genotype counts are tested against, and a departure is evidence that something — inbreeding, mixing of populations, a genotyping fault — is going on.
The answers describe populations, not people. A carrier frequency of 1 in 51 says nothing about whether a particular person carries the allele; family history and testing settle that, and the carrier probability calculator is built for the question.
What is hardy-weinberg equilibrium calculator?
The Hardy–Weinberg principle says that in an idealised population, allele frequencies stay the same from one generation to the next, and after a single round of random mating the genotypes settle into the proportions p² : 2pq : q². Here p and q are the frequencies of the two alleles at one autosomal locus, so p + q = 1, and squaring that identity gives p² + 2pq + q² = 1. The US National Research Council's report on forensic DNA puts it in words: people with two copies of the same allele occur at the square of that allele's frequency, and people with two different alleles at twice the product of the two frequencies.
The principle was published twice in 1908. G. H. Hardy, a Cambridge mathematician, wrote a short letter to Science answering a suggestion by Udny Yule that a dominant trait such as brachydactyly should, left alone, spread until affected people outnumbered unaffected ones three to one. Hardy showed that the proportions simply stay where they are. Wilhelm Weinberg, a Stuttgart physician, derived the same result in German the same year, and his paper went largely unrecognised in English-language genetics for about thirty-five years.
Random mating is the textbook condition, but a 2023 analysis by Stark in Hereditas argues it is sufficient rather than necessary: some non-random mating patterns also keep the proportions stable. That does not change any number here.
How to use this calculator.
- Under 'What do you already know?', choose the frequency you have. For a recessive condition counted from affected people, that is the recessive phenotype, q². If a study reports allele frequencies directly, choose p or q instead.
- Enter it as a proportion between 0 and 1, not a percentage: 1 in 10,000 is 0.0001 and 4% is 0.04. Exactly 0 and exactly 1 are rejected, because one allele would then be absent and no heterozygotes could exist.
- Enter a population size if you want an expected head-count of carriers. It changes no frequency; it only multiplies 2pq.
- Read 2pq as the share of everybody who carries one copy. If your question is about people already known to be unaffected — healthy relatives, a screened couple — read the carriers-among-unaffected line instead.
- Match your reported precision to the input. An incidence of 'about 1 in 10,000' supports two significant figures, so a carrier frequency of about 0.020, or 1 in 50, is as far as the data go.
The formula.
Picture the population's gametes as one large pool. A gamete drawn at random carries A with probability p and a with probability q, and under random mating the egg and sperm are drawn independently. The pairings are A with A (p × p), A with a (p × q), a with A (q × p) and a with a (q × q). The two mixed pairings give the same genotype, so the heterozygote frequency is 2pq, and the total p² + 2pq + q² is (p + q)², which is 1.
Each starting point recovers p and q first: recessive phenotype: q = √(q²), p = 1 − q homozygous dominant: p = √(p²), q = 1 − p allele frequency: the other allele is 1 minus it dominant phenotype D = p² + 2pq = 1 − q², so q = √(1 − D) The square-root routes assume complete dominance, so that the aa genotype is exactly the recessive phenotype.
From p and q come p², 2pq and q², the dominant phenotype p² + 2pq, and the expected number of carriers, 2pq × population size. Carriers as a share of unaffected people is 2pq ÷ (p² + 2pq), which simplifies to 2q ÷ (1 + q). The carrier odds line is 1 ÷ 2pq, shown to one decimal place when it is below 10 and rounded to a whole number from 10 upwards. Genotype frequencies are shown to ten decimal places, so for an allele rarer than about q = 7 × 10⁻⁶ the q² line reads 0; the odds are worked out before that rounding and stay meaningful.
When Hardy–Weinberg is the null hypothesis rather than the model, observed genotype counts are compared with p²N, 2pqN and q²N in a chi-square test on one degree of freedom — three classes, minus one for the fixed total, minus one because p was estimated from the same counts. Wigginton, Cutler and Abecasis (2005) showed that this chi-square approximation can reject too often when the minor allele is uncommon, even in samples of around a thousand people, and recommended an exact test there.
A worked example.
A recessive condition affects 1 person in 10,000, and you want the carrier frequency and the expected number of carriers in a town of 50,000. The affected people are the aa homozygotes, so q² = 0.0001 and q = √0.0001 = 0.01. Then p = 1 − 0.01 = 0.99. Genotype frequencies: p² = 0.99 × 0.99 = 0.9801; 2pq = 2 × 0.99 × 0.01 = 0.0198; q² = 0.0001. They sum to 0.9801 + 0.0198 + 0.0001 = 1. The carrier frequency is therefore 0.0198, and 1 ÷ 0.0198 = 50.5, shown as about 1 in 51. The dominant phenotype covers 0.9801 + 0.0198 = 0.9999 of people, and carriers among those unaffected people come to 2q ÷ (1 + q) = 0.02 ÷ 1.01, or about 0.0198 again; removing so few affected people barely moves the denominator. In a town of 50,000 the model expects 0.0198 × 50,000 = 990 carriers and 0.0001 × 50,000 = 5 affected residents, 198 carriers for each affected person. A real town will scatter around those figures, and since the incidence was only known to two significant figures, 'roughly a thousand carriers' is the fair way to report it.
Frequently asked questions.
Why do I take the square root of the affected frequency?
If 4% of people show a recessive trait, what share of the rest are carriers?
How good is the shortcut that carrier frequency is about 2q?
Why does selection remove a rare recessive allele so slowly?
How do I test whether real genotype counts fit Hardy–Weinberg?
Does Hardy–Weinberg apply to genes on the X chromosome?
What changes when a gene has three or more alleles?
How is the carrier odds line rounded for a common allele?
Can I use the carrier frequency as my own chance of being a carrier?
References& sources.
- [1]Hardy, G. H. (1908). Mendelian proportions in a mixed population. Science 28(706):49–50. The original half-page letter showing that under random mating the genotype proportions p², 2pq and q² are stable from one generation to the next. Freely readable as an archival page-image reprint in the Yale Journal of Biology and Medicine 76(2):79–80 (2003). Independent, free, archival scan; retrieved 2026-07-29.
- [2]National Research Council (US) Committee on DNA Forensic Science (1996). The Evaluation of Forensic DNA Evidence, Chapter 4, section 'Random Mating and Hardy-Weinberg Proportions'. National Academies Press; NCBI Bookshelf NBK232608. Source of the plain-language statement of the proportions used in the 'What is' section: the proportion of persons with two copies of the same allele is the square of that allele's frequency, and the proportion with two different alleles is twice the product of the two frequencies. Independent, free, US National Academies; retrieved 2026-07-29.
- [3]Ogino, S. & Wilson, R. B. (2004). Bayesian analysis and risk assessment in genetic counseling and testing. Journal of Molecular Diagnostics 6(1):1–9. PMC1867463. Source for deriving the carrier frequency 2(1 − q)q from the disease frequency q² under Hardy-Weinberg equilibrium, and for the stated small-q approximation 2q. Independent, free full text; retrieved 2026-07-29.
- [4]Saadat, M. (2024). The importance of examining the Hardy-Weinberg Equilibrium in genetic association studies. Molecular Biology Research Communications 13(1):1–2, doi:10.22099/mbrc.2023.48386.1872. PMC10644312. Source for the conventional five-condition statement — a large population with random mating, and in the absence of mutation, migration, and natural selection. Independent, free, peer-reviewed; retrieved 2026-07-29.
- [5]Stark, A. E. (2023). Stable populations and Hardy-Weinberg equilibrium. Hereditas 160:19. PMC10161561. Consulted as an independent second authority: it confirms the p² : 2pq : q² arithmetic but dissents from the conventional teaching, arguing that random mating is a sufficient but not a necessary condition and exhibiting non-random mating schemes that also hold the proportions. Independent, free; retrieved 2026-07-29.
- [6]Wigginton, J. E., Cutler, D. J. & Abecasis, G. R. (2005). A note on exact tests of Hardy-Weinberg equilibrium. American Journal of Human Genetics 76(5):887–893. PubMed 15789306. Source for the caveat that the chi-square goodness-of-fit test for Hardy-Weinberg can have inflated type I error rates even in samples of about 1,000 individuals containing roughly 100 copies of the minor allele, and that an exact test should be preferred there. Independent; abstract free on PubMed, full text paywalled at the publisher; retrieved 2026-07-29.
- [7]NIST/SEMATECH (2012). e-Handbook of Statistical Methods, §1.3.5.15 'Chi-Square Goodness-of-Fit Test'. Source for the general degrees-of-freedom rule k − c, where c is the number of estimated parameters plus one — the rule that gives 1 degree of freedom for a two-allele Hardy-Weinberg test and k − 1 for a fixed Mendelian ratio. Independent, free, US National Institute of Standards and Technology; retrieved 2026-07-29.
- [8]Crow, J. F. (1999). Hardy, Weinberg and language impediments. Genetics 152(3):821–825. PMC1460671. Cited only for the historical point that Wilhelm Weinberg's independent 1908 German-language derivation was largely unrecognised in the English-speaking literature for roughly thirty-five years. Independent, free, PDF-only full text; retrieved 2026-07-29.
How this page was produced
- Published by
- Quanta Calculator
- Overseen by
- Daniel, Quanta Calculator Researcher
- Primary sources
- 8 cited below
- Method
- p + q = 1 → p² + 2pq + q² = 1
- Published
- Last verified
Built with AI assistance and verified by automated tests against the cited sources — every worked example on this page is computed by the same code that runs the calculator. How we build and check calculators.
In this category
Embed
Quanta Pro
Paid features are coming later.
- All 1560 calculators remain free
- No billing is enabled