How to use the allele frequency calculator
The calculator has two modes. Both describe the same kind of data: one sample, one locus, two allele types, and two allele copies per individual.
Simple mode (the starting mode) asks for three whole numbers:
AA countAa countaa count
Each field accepts a whole number from 0 to 1,000,000,000, and at least one individual must be entered across the three fields. The defaults are 50, 30 and 20 individuals.
Advanced mode asks for the observed percentage of each genotype:
AA percentageAa percentageaa percentage
Each field accepts a value from 0 to 100 in steps of 0.01 percentage point, and the three must total 99.99%, 100% or 100.01%. The defaults are 50%, 30% and 20%. Enter 30 for an observed proportion of 0.30, not 0.30.
A few practical points:
- Enter
0for a genotype that is absent from the sample. Do not leave the field empty. - Use all three genotype shares from the same sample. Mixing counts or percentages from different groups gives a number that describes neither.
- Results update as you type. Each mode keeps its own inputs when you switch between them.
- In Advanced mode, typing a percentage changes only that field. If the other two fields contain valid percentages, moving a slider redistributes the remaining share in proportion to their existing values (or as evenly as possible if both are zero). The calculator rounds to hundredths of a percentage point and keeps the total at 100%. If either field is blank or invalid, moving the slider leaves both other fields as they are.
Load examplefills the active mode with an all-heterozygote sample (All individuals are Aa: 0, 100, 0).Resetrestores the defaults in both modes and returns to Simple mode.Copysaves the calculation summary to your clipboard, andExportopens your browser's print dialog.- If an input is invalid, the tool shows an error and em dashes in the result fields. Typical causes are a missing or malformed value, a number outside the field limits, all-zero counts in Simple mode, or percentages that don't total about 100%.
The results show Allele A (p) and Allele a (q) as percentages, with a stacked bar showing the split. Advanced mode adds a Genotype frequencies table with Observed and Expected columns and paired bars on a common 0–100% scale.
What the calculator measures
An allele is one version of a gene or genetic marker. At a diploid locus, each individual carries two copies, so a sample of individuals contains allele copies. The allele frequency of A is the fraction of those copies that are A. The same is true for a.
You will also see this called gene frequency, and searches such as "calculating gene frequency" usually mean the same thing: the share of a particular variant in a sample. A locus is a location in the genome, and an allele is a version of the DNA sequence at that location. Allele frequency is the more precise term. This calculator finds the observed shares of A and a.
Two things are worth stating plainly:
- The calculation does not depend on dominance or phenotype. It works on genotypes. It doesn't matter whether
Ais dominant, or which allele is more common. - Direct allele counting makes no Hardy–Weinberg assumption. The values and are exactly what is observed in your sample. Hardy–Weinberg only enters when you ask what genotype proportions those allele frequencies would predict.
By convention, is the proportion of A and the proportion of a, so exactly.
Allele frequency formula from genotype counts
Let , and be the numbers of individuals with each genotype, and let
An AA individual contributes two A copies, an Aa individual contributes one A and one a, and an aa individual contributes two a copies. Counting copies gives the allele frequency formula:
The numerators are the total counts of A and a copies. The shared denominator, , is the total number of copies. Because the two numerators add up to , the two frequencies always sum to 1. This is the same formula people look for under "gene frequency formula": the share of a variant is its copies divided by all copies.
Multiply a proportion by 100 to express it as a percentage.
Allele frequency calculation example
Suppose a sample has 50 AA, 30 Aa and 20 aa individuals. This is the calculator's default Simple input.
- Count the individuals: .
- Count all allele copies: .
- Count
Acopies: . - Count
acopies: . - Divide by the total: and .
The calculator reports 65% for Allele A (p) and 35% for Allele a (q). You can check the work with a quick sum: .
A second example with unequal homozygotes: 12 AA, 36 Aa and 52 aa. Here and . The A copies number and the a copies number , so and .
Calculate allele frequency from genotype frequency
Sometimes you have genotype proportions rather than counts, for example from a published table. Let , and be the observed genotype proportions. Each AA individual is entirely A, and each Aa individual is half A, so:
This is the answer to "allele frequency from genotype frequency": add the homozygote's whole share to half of the heterozygote share.
Using the default Advanced input of 50%, 30% and 20%:
This matches the counts example, as it should, because 50, 30 and 20 individuals out of 100 are the same proportions.
How Advanced mode handles percentages that don't total 100
Rounded percentages often fall just short of or just over 100. Advanced mode accepts totals of 99.99%, 100% and 100.01%. Writing the entered percentages as , and , it computes the actual total
and normalizes each genotype as . It uses the actual total, so 99.99 or 100.01 is not silently treated as 100. When the rounded total is 99.99% or 100.01%, the calculator shows the advisory The genotype percentages were scaled to total 100%.
For example, 33.33%, 33.33%, 33.33% is accepted. The total is 99.99, each normalized proportion is exactly one-third, and
so the allele shares are 50% and 50%.
If your data come as counts, Simple mode is usually the better choice. It avoids the rounding that comes from converting counts to percentages first.
Hardy–Weinberg calculation: expected genotype frequencies
Once you have and , you can ask what genotype proportions would occur if the two allele copies in each individual were paired at random. That gives the Hardy–Weinberg formula:
for AA, Aa and aa respectively. These three sum to .
The factor of 2 in appears because an Aa individual can arise in two ways: A from one parent and a from the other, or the reverse. The two orders of pairing unlike alleles each have probability .
For the default Advanced input, and :
- Expected
AA: , or42.25% - Expected
Aa: , or45.5% - Expected
aa: , or12.25%
The observed genotype shares were 50%, 30% and 20%. Observed Aa is lower than expected, and both homozygotes are higher.
How the calculator uses Hardy–Weinberg
In Advanced mode, the Genotype frequencies table lists observed and expected percentages in the order AA, Aa, aa, with paired bars on the same 0–100% scale. Three details matter:
- The expected values are calculated from the unrounded and , not from the displayed rounded percentages.
- The comparison is descriptive. The calculator does not show a difference column, expected counts, a chi-square statistic, a p-value or a verdict about equilibrium.
- A visible gap does not by itself show that a sample departs from Hardy–Weinberg equilibrium. Sampling variation can produce gaps, especially in small samples.
If you need a formal test, compute expected counts (, and ) and compare them with observed counts using a goodness-of-fit test. This calculator supplies and for that purpose but doesn't run the test.
What Hardy–Weinberg expectations assume
The expected proportions describe an idealized population: random pairing of alleles with respect to this locus, no selection on it, no mutation or migration changing allele frequencies, and a large enough population that chance changes are negligible. Real populations often depart from these conditions, and departures from the expected genotype shares can be informative. They can also come from sampling error or genotyping problems. Treat the comparison as a starting point for questions, not as an answer.
Calculate allele frequencies in the 5th generation
A common homework or lab question asks you to calculate allele frequencies in the fifth generation. The method is the same for any generation. Take the genotype counts or percentages observed in that generation, then apply the formulas above.
The calculator has no field for the generation number. To compare generations, run each generation's own observed data separately and compare the results.
If a problem gives you only starting frequencies and asks you to predict generation five, that requires a population-genetics model with stated assumptions, which this tool does not provide. If the problem instead gives genotype data collected in generation five, enter it here.
Edge cases and checks
| Sample | Allele result | Advanced comparison |
|---|---|---|
All Aa (0, 100, 0) |
50% A, 50% a |
100% observed Aa, 50% expected Aa |
All AA |
100% A, 0% a |
100% expected AA |
All aa |
0% A, 100% a |
100% expected aa |
| 33.33, 33.33, 33.33 | 50% and 50% |
25%, 50%, 25% expected |
The all-Aa case is a useful reminder that allele frequencies and genotype frequencies are different things. Every individual is heterozygous, yet the two alleles are equally common.
Display precision. Values are shown with up to four decimal places. A positive share smaller than 0.0001% displays as <0.0001%, and a share above 99.9999% but below 100% displays as >99.9999%. Exact endpoints display as 0% and 100%.
Limits of this calculator
The tool is deliberately narrow so that its output is unambiguous. It handles:
- one sample at one diploid locus with two alleles, labeled
Aanda - observed genotype counts or percentages as input
It does not handle:
- loci with three or more alleles
- phenotype data, such as counting dominant and recessive individuals, where heterozygotes can't be seen directly
- sequencing reads or pooled data
- generation-by-generation projections
- confidence intervals, significance tests or equilibrium verdicts
The result describes the sample you enter. If the sample is a small subset of a larger population, the true population frequencies may differ, and the calculator does not quantify that uncertainty.
Frequently asked questions
How do you calculate allele frequency from genotype counts?
Count the copies of each allele, then divide by the total number of copies. For A, that is . For a, it is .
What is the allele frequency formula if I have percentages?
Add the homozygote's proportion to half the heterozygote proportion. For A, . To get the genotype proportions, divide each entered percentage by the actual total of the three entries (99.99, 100, or 100.01).
Do p and q always add up to 1?
Yes. Every allele copy in the sample is either A or a, so the two frequencies sum to exactly 1, or 100%. Displayed values may differ from 100% in the last decimal place only because of display rounding.
Is allele frequency the same as genotype frequency?
No. Allele frequency counts individual allele copies, while genotype frequency counts individuals with a given pair of alleles. The two are linked by the formulas above, and Hardy–Weinberg expectations connect them under random pairing.
Does the calculator tell me whether my sample is in Hardy–Weinberg equilibrium?
No. It shows observed and expected genotype percentages side by side but does not test the difference. A formal goodness-of-fit test is needed for that.
Does it matter which allele I call A?
No. The labels are interchangeable. Swapping them swaps and and the matching genotype shares, and nothing else changes.
Can I use it for a dominant trait?
Only if you know the genotypes. The calculator works from genotype data. If you only have phenotype counts, you cannot count allele copies directly without an extra assumption, and this tool does not make one.
Read the formula definitions, supported input ranges, and limitations before using this estimate.