Allele Frequency Calculator

Allele Frequency Calculator

Calculate allele frequencies (p and q) from genotype counts (AA, Aa, aa) using the Hardy-Weinberg equation.

Last updated: March 2026

p² + 2pq + q² = 1 · p + q = 1
Enter genotype counts (AA, Aa, aa) to calculate p, q, and expected frequencies

Genotype Counts

Allele frequency formulas

p = (2×AA + Aa) ÷ (2×N)

q = 1 - p

What is Allele Frequency?

Allele frequency, also called gene frequency, represents how common a particular allele (version of a gene) is within a population. For a gene with two alleles—dominant (A) and recessive (a)—the frequencies are denoted as p and q, where p + q = 1. These frequencies are fundamental to understanding genetic variation, evolution, and inheritance patterns in populations.

The Hardy-Weinberg principle, formulated in 1908, describes the mathematical relationship between allele frequencies and genotype frequencies in a population at equilibrium. Under specific conditions (no mutation, random mating, no selection, large population, no migration), allele frequencies remain constant across generations, and genotype frequencies follow the equation: p² + 2pq + q² = 1. This principle serves as a null hypothesis for detecting evolutionary forces—deviations from expected frequencies indicate factors like natural selection, genetic drift, or non-random mating are acting on the population.

Calculating allele frequencies from genotype counts is essential in conservation biology (tracking genetic diversity in endangered species), medical genetics (estimating carrier frequencies for recessive diseases), agriculture (breeding programs), and evolutionary studies (detecting selection pressures). For example, if a recessive genetic disorder has frequency q² = 0.0001 (1 in 10,000), we can calculate q = 0.01 and p = 0.99, revealing that the carrier frequency (2pq) is approximately 0.0198 or ~1 in 50 individuals—critical information for genetic counseling.

How to Calculate Allele Frequencies

Calculation Process

Step 1: Count individuals with each genotype: AA, Aa, aa
Step 2: Calculate total population: N = AA + Aa + aa
Step 3: Calculate p = (2×AA + Aa) ÷ (2×N)
Step 4: Calculate q = 1 - p
Step 5: Calculate expected frequencies: p², 2pq, q²
Step 6: Multiply by N to get expected counts

Hardy-Weinberg Formulas

Allele Frequencies:
p = (2×AA + Aa) ÷ (2×N)
q = 1 - p
Expected Genotype Frequencies:
p² + 2pq + q² = 1
Where:
• p² = frequency of AA (homozygous dominant)
• 2pq = frequency of Aa (heterozygous)
• q² = frequency of aa (homozygous recessive)

Pro Tip: The factor of 2 in the numerator accounts for diploid organisms having two copies of each gene. AA individuals contribute 2 A alleles, while Aa individuals contribute 1 A allele.

Example Calculation

Calculate allele frequencies for a population with 50 AA, 40 Aa, and 10 aa individuals:

Given:
AA = 50
Aa = 40
aa = 10
Step 1:
Calculate total population:
N = 50 + 40 + 10 = 100 individuals
Step 2:
Calculate frequency of A allele (p):
p = (2×AA + Aa) ÷ (2×N)
p = (2×50 + 40) ÷ (2×100)
p = (100 + 40) ÷ 200
p = 140 ÷ 200 = 0.7000
Step 3:
Calculate frequency of a allele (q):
q = 1 - p
q = 1 - 0.7000 = 0.3000
Step 4:
Calculate Hardy-Weinberg expected frequencies:
p² = 0.7² = 0.4900 (expected AA)
2pq = 2×0.7×0.3 = 0.4200 (expected Aa)
q² = 0.3² = 0.0900 (expected aa)
Step 5:
Calculate expected counts:
Expected AA = 0.4900 × 100 = 49.0
Expected Aa = 0.4200 × 100 = 42.0
Expected aa = 0.0900 × 100 = 9.0
Result:
p = 0.7000, q = 0.3000

The observed counts (50, 40, 10) are very close to Hardy-Weinberg expected (49, 42, 9), suggesting the population is in equilibrium with random mating and no significant evolutionary forces.

Frequently Asked Questions

What does Hardy-Weinberg equilibrium mean?

Hardy-Weinberg equilibrium describes a theoretical population where allele and genotype frequencies remain constant across generations. This requires: no mutations, random mating, no natural selection, infinitely large population, and no gene flow. Real populations rarely meet all conditions, making deviations useful for detecting evolutionary forces.

How do you calculate allele frequency?

Use the formula p = (2×AA + Aa) ÷ (2×N) to find the dominant allele frequency, then calculate q = 1 - p.

How do you calculate p and q?

p is calculated from genotype counts using allele totals, and q is found using q = 1 - p under the Hardy-Weinberg equation.

Why multiply AA by 2 in the formula?

Each diploid individual has two copies of every gene. An AA individual contributes 2 A alleles to the gene pool, while an Aa individual contributes only 1 A allele. The total number of alleles in the population is 2N (twice the number of individuals), hence the denominator 2N in the frequency calculation.

How do I test if my population is in equilibrium?

Use a chi-square (χ²) goodness-of-fit test comparing observed genotype counts to Hardy-Weinberg expected counts. Calculate χ² = Σ[(observed - expected)² / expected] with 1 degree of freedom. If χ² exceeds critical value (3.841 at p=0.05), reject equilibrium—indicating evolutionary forces are acting.

Can I use this for more than two alleles?

Yes, but the formula becomes more complex. For three alleles (A₁, A₂, A₃) with frequencies p, q, r (where p+q+r=1), the expanded Hardy-Weinberg equation is: (p+q+r)² = p²+q²+r²+2pq+2pr+2qr = 1. Each term represents a genotype frequency.

What causes deviations from Hardy-Weinberg?

Common causes: inbreeding (increases homozygosity, reduces heterozygotes), assortative mating (like mates with like), natural selection (favors certain genotypes), genetic drift (random changes in small populations), mutation (introduces new alleles), and gene flow (migration between populations).

Why is the heterozygote frequency 2pq, not pq?

There are two ways to form an Aa heterozygote: inheriting A from mom and a from dad (frequency p×q), or inheriting a from mom and A from dad (frequency q×p). These are mutually exclusive events, so we add them: pq + qp = 2pq.

How do I calculate carrier frequency for recessive diseases?

If a recessive disease has incidence q² (frequency of aa affected individuals), calculate q = √(q²), then p = 1-q. Carrier frequency is 2pq. Example: If disease incidence is 1/10,000 (0.0001), then q = 0.01, p = 0.99, and carrier frequency = 2(0.99)(0.01) ≈ 0.02 or 1 in 50.

Can allele frequencies exceed 1?

No, never. Allele frequencies are proportions and must fall between 0 and 1. If your calculation gives p or q outside this range, you've made an error—check that you're dividing by 2N (total alleles) not N (total individuals), and verify your genotype counts are correct.

Related Tools