Audited 29 Jul 2026·Last updated 28 Oct 2026·8 citations·Tier 1·0 uses

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

What do you already know?
A dimensionless proportion strictly between 0 and 1 — not a percentage. One in ten thousand is 0.0001; 36 percent is 0.36. Exactly 0 and exactly 1 are rejected because the locus would be fixed and there would be no heterozygotes left to describe.
Head-count used only to turn the carrier frequency 2pq into an expected number of carriers. It does not affect p, q or any frequency — Hardy-Weinberg assumes an infinitely large population.
people
Heterozygote (carrier) frequency, 2pq
0.0198
2pq, the expected share of the whole population carrying one copy of each allele (genotype Aa), from 0 to 0.5.
Dominant allele frequency (p)
0.99
Recessive allele frequency (q)
0.01
Homozygous dominant frequency (p²)
0.9801
Homozygous recessive frequency (q²)
1.000 × 10⁻⁴
Dominant phenotype frequency (p² + 2pq)
0.9999
Carriers as a share of unaffected people
0.0198
Expected carriers in this population
990 people
Carrier odds
about 1 in 51

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.

  1. 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.
  2. 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.
  3. Enter a population size if you want an expected head-count of carriers. It changes no frequency; it only multiplies 2pq.
  4. 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.
  5. 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.

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

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.

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.

population Size50,000
value0
known Quantityrecessive-phenotype-frequency

Frequently asked questions.

Why do I take the square root of the affected frequency?
For a completely recessive trait, the only genotype you can identify by looking is aa, and Hardy–Weinberg puts its frequency at q². Taking the square root recovers q. That step leans hardest on the assumptions: inbreeding raises the share of aa above q², so the square root overstates q. If heterozygotes can be recognised — codominance, a genetic test — count genotypes with the allele frequency calculator instead.
If 4% of people show a recessive trait, what share of the rest are carriers?
q² = 0.04 gives q = 0.2 and p = 0.8, so p² = 0.64, 2pq = 0.32 and 96% show the dominant phenotype. Among those unaffected people, carriers make up 0.32 ÷ 0.96, exactly one third. In a population of 50,000 that is 16,000 carriers. Compare the rare case: as an allele becomes rarer the carrier share falls, but the fraction of its copies hidden in carriers rises toward 1.
How good is the shortcut that carrier frequency is about 2q?
Close for rare alleles, and always slightly high, because the exact value 2pq is 2q multiplied by p. At q = 0.01 the shortcut gives 0.02 against 0.0198, about 1% too high. For a condition affecting 1 in 2,500, q = 0.02 and the shortcut gives 0.04 against 0.0392, about 2% high, roughly 1 in 25 instead of 1 in 26. Genetic-counselling texts such as Ogino and Wilson (2004) note the same approximation.
Why does selection remove a rare recessive allele so slowly?
Because almost every copy sits in a carrier. The share of a recessive allele's copies found in heterozygotes is 2pq ÷ (2pq + 2q²), which simplifies to p — 0.99 when q = 0.01. Even if no affected person ever reproduced, q would fall only as q₀ ÷ (1 + t·q₀) after t generations, so halving q from 0.01 to 0.005 takes 100 generations and reaching 0.001 takes 900.
How do I test whether real genotype counts fit Hardy–Weinberg?
Estimate p from the counts by gene counting, work out expected counts p²N, 2pqN and q²N, and compute a chi-square statistic on one degree of freedom; 3.841 is the 5% critical value. The allele frequency calculator does the counting and shows the heterozygote gap. When the minor allele is rare, so some expected counts are small, an exact test is more reliable than chi-square.
Does Hardy–Weinberg apply to genes on the X chromosome?
Not in the one-generation form used here. Individuals with two X chromosomes have genotypes at p², 2pq and q², but hemizygous individuals have only two genotypes, at p and q. If allele frequencies start out different in the two sexes, the gap halves and changes sign each generation and closes only gradually. This is also why X-linked recessive traits appear at frequency q in hemizygous individuals rather than q².
What changes when a gene has three or more alleles?
The binomial square becomes a multinomial one. With three alleles at frequencies p, q and r, (p + q + r)² = p² + q² + r² + 2pq + 2pr + 2qr: three homozygote classes and three heterozygote classes. Each homozygote is still its allele frequency squared and each heterozygote twice the product of its two alleles. The ABO blood group is the standard example, complicated by A and B both being dominant to O.
How is the carrier odds line rounded for a common allele?
The odds are 1 ÷ 2pq. Below 10 they are shown to one decimal place, so the line does not collapse to a coarse whole number for common alleles; from 10 upwards they are rounded to the nearest whole number. At q = 0.3, 2pq = 0.42 and 1 ÷ 0.42 = 2.38, displayed as about 1 in 2.4. When carriers are that common, read the frequency itself: 0.42 means 42 people in every 100.
Can I use the carrier frequency as my own chance of being a carrier?
Only if you know nothing else about yourself, and usually you do. The population figure ignores family history, ancestry and test results. A person whose sibling has a recessive condition has a two-in-three chance of being a carrier if unaffected, whatever the population frequency says. Questions about a specific person or couple belong with the carrier probability calculator and, for real decisions, a genetic counsellor.

References& sources.

  1. [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. [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. [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. [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. [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. [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. [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. [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
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
Coming soon