Allele Frequency Calculator
Count allele frequencies p and q from observed AA, Aa and aa genotype counts, autosomal or X-linked, and compare observed with expected heterozygosity.
Allele Frequency Calculator
Background.
Suppose 200 people have been genotyped at one SNP and the calls come back as 100 AA, 80 Aa and 20 aa. How common is the a allele in that group? Not 20 in 200. Allele frequency counts gene copies, not people: each person carries two copies, so there are 400 copies in the sample, and a accounts for 2 × 20 + 80 = 120 of them. Its frequency is 0.3.
That gene-counting method makes one demand: every genotype must be visible. It suits DNA genotyping, codominant blood groups such as MN, and any marker where a heterozygote can be told apart from both homozygotes. It cannot be used for a trait with complete dominance, where AA and Aa look the same; there the allele frequency has to be inferred from the recessive phenotype by assuming Hardy–Weinberg equilibrium, which is what the Hardy–Weinberg calculator does. When counting is possible, it assumes nothing about the population at all — not random mating, not a large size, not the absence of selection.
Because the counts are real data, they can be held up against the model. Expected heterozygosity, 2pq, is the share of heterozygotes Hardy–Weinberg proportions would give at the frequencies you just counted: 0.42 for the sample above, against 0.40 observed. The relative gap, (He − Ho) ÷ He, is reported with its direction — positive when heterozygotes are missing, negative when there are too many.
A gap of 0.0476 in 200 people is well within chance. Larger ones have a short list of explanations. Inbreeding and assortative mating thin out heterozygotes, and so does pooling two groups whose allele frequencies differ. In laboratory data the commonest cause is technical: an allele that fails to amplify turns true heterozygotes into apparent homozygotes.
For X-linked loci a separate mode counts hemizygous individuals as carrying one copy, which changes the denominator and confines the heterozygosity comparison to individuals with two X chromosomes.
What is allele frequency calculator?
An allele frequency is the share of all copies of a gene at one locus, in one sample, that are a particular allele. It describes a group, not a person: an individual has a genotype, while a population or sample has allele frequencies. With two alleles the frequencies p and q always add to 1, and p can be written either as copies counted over copies scored or as f(AA) + ½ f(Aa) — the homozygote share plus half the heterozygote share, since half a heterozygote's copies are A. In genomics the smaller of the two is called the minor allele frequency.
Two heterozygosity figures sit alongside. Observed heterozygosity, Ho, is the share of two-copy individuals who are actually heterozygous. Expected heterozygosity, He = 2pq, is the share that Hardy–Weinberg proportions predict at the observed allele frequencies; the US National Research Council's forensic DNA report describes it as twice the product of the two frequencies. Ho is an observation and He a model prediction. Their relative difference, (He − Ho) ÷ He, is the within-sample quantity that Wright's inbreeding coefficient F_IS describes, and following Holsinger and Weir a positive value indicates a deficiency of heterozygotes and a negative value an excess.
How to use this calculator.
- Choose the type of locus: Autosomal for any gene not on a sex chromosome, X-linked for genes on the X.
- Enter the number of individuals in each genotype class as whole numbers. If your data are proportions, multiply by the sample size first. Which allele you call A is arbitrary — a SNP's reference allele, M in the MN system — but keep the labelling consistent; swapping it swaps p and q and changes nothing else.
- In X-linked mode, put individuals with two X chromosomes in the AA, Aa and aa boxes and one-X individuals in the two hemizygous boxes. In autosomal mode the hemizygous boxes are ignored.
- Score each individual once. A duplicated sample, or several members of one family, adds extra copies of whatever genotypes they share and skews both p and the heterozygosity comparison.
- Read p and q, then compare observed with expected heterozygosity. For a formal test at a two-allele locus, the chi-square statistic equals the number of individuals times F squared; compare it with 3.841, the 5% critical value on one degree of freedom.
The formula.
Gene counting builds a numerator and a denominator from the same rule. An AA individual holds two A copies, an Aa individual one, an aa individual none, and a hemizygous A individual one. Every gene copy in the sample goes into the denominator.
Autosomal: p = (2·n(AA) + n(Aa)) ÷ 2N and q = (2·n(aa) + n(Aa)) ÷ 2N, where N is the number of individuals. Add the two and the numerator becomes 2N, so p + q = 1 is guaranteed by the arithmetic rather than imposed.
X-linked: p = (2·n(AA) + n(Aa) + n(A hemi)) ÷ (2·N₂ₓ + N₁ₓ), where N₂ₓ counts individuals with two X chromosomes and N₁ₓ hemizygous individuals. A common error is to use twice the total head-count; with 100 of each type that gives 400 copies instead of 300 and understates every frequency.
Observed heterozygosity is n(Aa) ÷ N₂ₓ — in autosomal mode N₂ₓ is simply N. Hemizygous individuals are left out because a single copy cannot be heterozygous. Expected heterozygosity is 2pq using the pooled allele frequencies, which presumes the frequency is the same in both sexes; at an X-linked locus where it differs, the comparison mixes the two.
The departure is F = (He − Ho) ÷ He. For a two-allele locus it links directly to the usual goodness-of-fit test: the chi-square statistic comparing observed counts with p²N, 2pqN and q²N equals N × F², tested on one degree of freedom because p was estimated from the same counts. F here is the plain descriptive ratio, not the sample-size-corrected estimator of Weir and Cockerham (1984), which differs noticeably in small samples.
Some samples cannot give an answer and are refused: negative or fractional counts, a sample with nobody in it, an X-linked sample with no two-X individuals (Ho would be 0 ÷ 0), and a monomorphic sample in which every copy is the same allele. In the last case He is zero and F would be 0 ÷ 0; frequencies of 1 and 0 are the complete answer.
A worked example.
Take the sample of 200 people at an autosomal SNP: 100 AA, 80 Aa and 20 aa. Gene copies: 200 × 2 = 400. A copies: 2 × 100 from the AA group plus 80 from the heterozygotes = 280, so p = 280 ÷ 400 = 0.7. a copies: 2 × 20 + 80 = 120, so q = 120 ÷ 400 = 0.3. The two add to 1. Observed heterozygosity is 80 ÷ 200 = 0.4. Expected heterozygosity at these frequencies is 2 × 0.7 × 0.3 = 0.42, which in head-count terms is 84 heterozygotes against the 80 found. The relative shortfall is (0.42 − 0.40) ÷ 0.42 = 0.0476, positive, so the reading is a heterozygote deficiency with F = +0.0476. Is that shortfall meaningful? The chi-square statistic is 200 × 0.0476² = 0.454 on one degree of freedom, far below the 3.841 needed for significance at 5%. Four missing heterozygotes in 200 people is the sort of gap sampling alone produces, and these counts are consistent with Hardy–Weinberg proportions.
Frequently asked questions.
Why isn't the a allele frequency just the number of aa people divided by the sample size?
Can I count alleles for a trait where AA and Aa look the same?
Is there a published example I can check the method against?
How does the X-linked mode change the numbers?
What produces a heterozygote deficiency?
What does a negative value, a heterozygote excess, point to?
Can I report the deficiency ratio as F_IS in a paper?
How many individuals do I need for a reliable allele frequency?
What about markers with more than two alleles?
Why is a sample where everyone is AA rejected?
References& sources.
- [1]National Institute of Justice (US Department of Justice). Population Genetics and Statistics for Forensic Analysts, module 'Population Theory — Hardy-Weinberg Principle'. Source for the gene-counting method as stated for practitioners, and for the independent 'Forensic Town, USA' worked example (n = 5,000; p = 0.547, q = 0.453; expected genotype counts 1,496 / 2,478 / 1,026) used as this page's independent cross-check. Independent, free, US Department of Justice; retrieved 2026-07-29.
- [2]Holsinger, K. E. & Weir, B. S. (2009). Genetics in geographically structured populations: defining, estimating and interpreting F_ST. Nature Reviews Genetics 10(9):639–650, doi:10.1038/nrg2611. PMC4687486. Source for the sign convention used by the interpretation line: f is a measure of the frequency of heterozygotes compared with that expected under Hardy-Weinberg proportions, and positive values indicate a deficiency of heterozygotes while negative values indicate an excess. Independent, free via PubMed Central; retrieved 2026-07-29.
- [3]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 for the expected-heterozygosity benchmark: the proportion of persons with two different alleles is twice the product of the two frequencies. Independent, free, US National Academies; retrieved 2026-07-29.
- [4]Weir, B. S. & Cockerham, C. C. (1984). Estimating F-statistics for the analysis of population structure. Evolution 38(6):1358–1370. Cited to mark the boundary of what this page reports: the sample-size-corrected F_IS estimator defined here is NOT the simple (He − Ho)/He ratio this calculator prints, and the two differ in small samples. Independent; paywalled at the publisher and JSTOR — bibliographic reference only, no figure on this page depends on it; checked 2026-07-29.
- [5]Hardy, G. H. (1908). Mendelian proportions in a mixed population. Science 28(706):49–50. Free archival reprint in the Yale Journal of Biology and Medicine 76(2):79–80 (2003). The origin of the 2pq expectation this page uses as its benchmark. Independent, free, archival scan; retrieved 2026-07-29.
- [6]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 the relationship between an allele frequency q and the derived carrier frequency 2(1 − q)q under Hardy-Weinberg equilibrium, which is where an allele frequency computed on this page is most often used next. Independent, free full text; retrieved 2026-07-29.
How this page was produced
- Published by
- Quanta Calculator
- Overseen by
- Daniel, Quanta Calculator Researcher
- Primary sources
- 6 cited below
- Method
- p = (2·n(AA) + n(Aa) + n(A hemi)) ⁄ (2·N₂ₓ + N₁ₓ)
- 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