Allele Frequency Calculator

Allele Frequency Calculator

Turn genotype counts into allele frequencies p and q, test whether your sample fits Hardy–Weinberg equilibrium, or estimate how common carriers are from how often a recessive trait appears.

p = (2·AA + Aa) ÷ 2N · q = 1 − p · p² + 2pq + q² = 1

Counts of individuals, not percentages. You need to be able to tell AA from Aa, for example from a DNA test or a codominant trait.

p (A allele)
0.7
q (a allele)
0.3
Observed genotype counts compared with Hardy–Weinberg expectations
GenotypeObservedExpectedHW frequency
AA5049p² = 0.49
Aa40422pq = 0.42
aa109q² = 0.09
0.227
Chi-square (1 df)
0.6339
Consistent with equilibrium
0.048
F: heterozygote shortfall (40% Aa vs 42% expected)

What Allele Frequency Measures

Allele frequency is the share of all copies of a gene in a population that are one particular version. If 100 plants carry 200 copies of a gene and 140 of them are A, the frequency of A is p = 0.7 and the frequency of a is q = 0.3.

Evolution, at its simplest, is a change in allele frequencies over generations. Measuring them is the starting point for studying selection, genetic drift, migration and inbreeding, and for estimating how many people carry a recessive condition.

The Hardy–Weinberg principle says that if nothing is pushing the population (no selection, mutation, migration or drift, and random mating), genotypes settle at p², 2pq and q². Comparing real counts with those numbers tells you whether something is going on.

Allele Frequency and Hardy–Weinberg Formulas

N = AA + Aa + aa (individuals) · 2N = gene copies
p = (2·AA + Aa) ÷ 2N · q = (2·aa + Aa) ÷ 2N = 1 − p
Expected: AA = p²N · Aa = 2pqN · aa = q²N
χ² = Σ (observed − expected)² ÷ expected, 1 degree of freedom
F = 1 − observed Aa share ÷ 2pq
From a recessive trait: q = √(share affected), carriers = 2pq
  • Why 2 × AA? Each AA individual carries two A copies; each Aa carries one.
  • Why 1 degree of freedom? Three genotype classes, minus one because they must add to N, minus one more because p was estimated from the same data.
  • F is positive when there are fewer heterozygotes than expected, the classic sign of inbreeding or of a sample that mixes two populations.

Worked Example: Testing 100 Plants

Given:
A sample of 100 plants: 50 AA, 40 Aa, 10 aa.
Alleles:
p = (2×50 + 40) ÷ 200 = 0.7 · q = 0.3
Expected:
AA 0.49×100 = 49 · Aa 0.42×100 = 42 · aa 0.09×100 = 9
Chi-square:
1²/49 + 2²/42 + 1²/9 = 0.020 + 0.095 + 0.111 = 0.227
Result:
p-value 0.63. Well above 0.05 (critical χ² = 3.84), so the sample is consistent with Hardy–Weinberg equilibrium. Change the counts to 60 / 20 / 20 and p and q stay exactly the same, but χ² jumps to 27.4: far too few heterozygotes.

Carrier Frequency for Recessive Traits

Assuming Hardy–Weinberg proportions. Rare recessive alleles hide almost entirely in carriers.

Allele frequency and carrier frequency for recessive traits of different rarity
Trait affectsqCarriersCarriers per affected
1 in 1000.11 in 5.618
1 in 1,0000.03161 in 16.361
1 in 2,5000.021 in 25.598
1 in 10,0000.011 in 50.5198
1 in 100,0000.00321 in 158.6630

This is why selection against a rare recessive trait is so slow: almost every copy of the allele is in someone who doesn't show it.

Common Allele Frequency Mistakes

  • Dividing by N instead of 2N. You're counting gene copies, and every diploid individual has two.
  • Taking q as the share of aa individuals. The share of aa individuals is q², so q is its square root. If 9% are aa, q is 0.3, not 0.09.
  • Using the square-root shortcut on a population you're testing. q = √(aa share) assumes equilibrium already. If you have AA and Aa counts, count alleles directly instead.
  • Reading "consistent with equilibrium" as proof. A high p-value means the data don't show a departure. Small samples rarely do, even when something is going on.
  • Assuming the dominant allele is the common one. Dominance and frequency are unrelated. Plenty of dominant alleles are rare.

Allele Frequency FAQs

Why is the heterozygote frequency 2pq?

There are two ways to be Aa: A from the mother and a from the father (p × q), or the reverse (q × p). Adding them gives 2pq.

What makes a population fall out of equilibrium?

Non-random mating (especially inbreeding), selection, migration between populations, mutation and genetic drift in small populations. A shortage of heterozygotes points towards inbreeding or a mixed sample.

Can I use this with three or more alleles?

Not directly. With alleles of frequencies p, q and r the genotype frequencies come from (p + q + r)², giving p², q², r², 2pq, 2pr and 2qr, and the test has more degrees of freedom.

How accurate is the carrier estimate?

It’s a good first estimate for a rare recessive condition in one population. Real carrier rates differ between ancestries and can be affected by consanguinity, so clinical carrier figures come from screening data, not from this formula.

Sources

  • OpenStax, Biology 2e, chapter 19: population genetics and the Hardy–Weinberg principle.
  • M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions (1964), formula 7.1.26, used for the chi-square p-value.
  • J. E. Wigginton, D. J. Cutler and G. R. Abecasis, "A note on exact tests of Hardy-Weinberg equilibrium", American Journal of Human Genetics 76 (2005): why exact tests are preferred for small samples.

Related Tools