Allele Frequency Calculator

Share:

Allele frequency calculator — enter the observed counts of the three genotypes (AA, Aa, aa) and get the allele frequencies p and q, the Hardy-Weinberg expected counts, and a χ² goodness-of-fit statistic. For A-Level and IB population genetics. Runs in your browser.

RT-SCI-034 · Science
Your browser is too old for this tool’s interactive features. Please update to Safari 13.1, Chrome or Edge 80, Firefox 74 or newer.

Allele Frequency Calculator

p = (2·AA + Aa) ÷ 2N  ·  q = (2·aa + Aa) ÷ 2N

Enter the observed counts of all three genotypes. The calculator returns the allele frequencies p and q, the Hardy-Weinberg expected counts, and a χ² statistic.

Advertisement
After tool · AD-W1Responsive
Tool information
Curriculum
English (global) — Cambridge International + IB
Built against
Cambridge International A-Level Biology 9700 + IB Diploma (2023–2025) — Population genetics & the χ² test
Unit system
SI primary; US/imperial readout below
First published
2 Jun 2026
Last updated
13 Sep 2026

How to Use the Allele Frequency Calculator

Count each genotype

From your data, count how many individuals are homozygous dominant (AA), heterozygous (Aa) and homozygous recessive (aa).

Enter the three counts

Type each count into its box. The total population size N is worked out for you by adding them.

Read p and q

The calculator counts alleles directly: p = (2·AA + Aa) ÷ 2N and q = (2·aa + Aa) ÷ 2N. These are the observed allele frequencies.

Compare with Hardy-Weinberg

The expected counts under Hardy-Weinberg and a χ² statistic (df = 1) are shown, so you can test whether the population is in equilibrium.

Advertisement
After how-to · AD-W2Responsive

Allele Frequencies & Testing Hardy-Weinberg

Allele Frequency

Example: A sample of 100 individuals contains 60 AA, 30 Aa and 10 aa. Find the allele frequencies.

Counting alleles: p = (2×60 + 30) ÷ (2×100) = 150 ÷ 200 = 0.75, and q = (2×10 + 30) ÷ 200 = 0.25.

p = 0.75  ·  q = 0.25  ·  χ² ≈ 4.0 (df = 1)

Allele frequencies are found by counting alleles directly from genotype data, which is the most reliable approach when you can identify every genotype. Each homozygote carries two copies of one allele and each heterozygote carries one of each, so for a gene with two alleles the dominant allele frequency is p = (2·AA + Aa) ÷ 2N and the recessive allele frequency is q = (2·aa + Aa) ÷ 2N, where N is the number of individuals and 2N is the total number of alleles. By construction p and q add to one. This counting method does not assume the population is in equilibrium — it simply measures what is actually there.

Once you have p and q, you can ask whether the population is in Hardy-Weinberg equilibrium by comparing the observed genotype counts with the counts you would expect from p² , 2pq and q² multiplied by N. The χ² goodness-of-fit test quantifies the mismatch: a small χ² means the observed and expected counts are close, while a large one signals a departure from equilibrium. With three genotype classes, one lost to fixing the total and one to the single allele frequency estimated from the same data (q follows as 1 − p), the test has one degree of freedom, for which the 5% critical value is 3.84 — a χ² above that is conventionally taken as significant evidence against Hardy-Weinberg. All calculation happens in your browser, so nothing you type is uploaded and the tool works offline once loaded.

Counting alleles measures a population as it is; the χ² test then asks whether it is sitting still or being pushed by evolution.

Counting alleles assumes no equilibrium at all

01

p = (2·AA + Aa) ÷ 2N,  q = (2·aa + Aa) ÷ 2N.

02

There are 2N alleles in N diploid individuals.

03

Counting alleles makes no equilibrium assumption.

04

p and q always sum to one.

05

Expected counts use p², 2pq, q² × N.

06

The χ² test compares observed with expected.

07

Here the test has 1 degree of freedom.

08

The 5% critical value at df = 1 is 3.84.

09

A large χ² is evidence against Hardy-Weinberg.

10

This calculator runs in your browser — your working stays private.

📅 Research current as of 13 Sep 2026 · Sources: Hardy, Science 1908;28(706):49-50 and Weinberg, Jahreshefte des Vereins für vaterländische Naturkunde in Württemberg 1908;64:369-382; Hartl and Clark, Principles of Population Genetics, 4th ed. (2007); NIST/SEMATECH e-Handbook §1.3.6.7.4 for the chi-square critical value
Standards, published formulas, and reference data are revised over time — check against a current authoritative source before relying on these figures.

Frequently Asked Questions

  • By counting alleles directly. Each AA individual carries two dominant alleles, each Aa carries one of each, and each aa carries two recessive alleles. So p = (2·AA + Aa) ÷ 2N and q = (2·aa + Aa) ÷ 2N, where N is the total number of individuals and 2N is the total number of alleles.
  • Because each individual is diploid and therefore carries two alleles at the locus. A sample of N individuals contains 2N alleles in total, so dividing the count of a given allele by 2N converts it into a frequency between 0 and 1.
  • No. Counting alleles from observed genotypes measures the population as it actually is, with no assumptions. The Hardy-Weinberg expectation is only used afterwards, as a comparison, when you want to test whether the population is in equilibrium.
  • It is a goodness-of-fit measure of how far the observed genotype counts are from the counts expected under Hardy-Weinberg (p²N, 2pqN, q²N). It is the sum over the three genotypes of (observed − expected)² ÷ expected. A small value means a good fit; a large value means the observed data depart from equilibrium.
  • There are three genotype classes, which would give two degrees of freedom, but one more is subtracted because the allele frequency was estimated from the same data. Three classes minus one for the total minus one for the estimated frequency leaves one degree of freedom.
  • Compare it with the critical value for df = 1, which is 3.84 at the 5% significance level. If your χ² is below 3.84, the data are consistent with Hardy-Weinberg; if it is above 3.84, the departure is statistically significant and something — selection, non-random mating, drift or migration — may be acting.
  • A zero count is allowed and simply means that genotype was not observed. The calculator still works, although a zero expected count is skipped in the χ² sum to avoid dividing by zero. Very small samples make the χ² test unreliable, so larger counts are preferable.
  • The Tool Information block lists the exact syllabus — Cambridge A-Level Biology 9700 and IB Diploma population genetics, including the χ² test. It is a study aid for checking your working, not a substitute for your official syllabus or teacher.
  • No. Every calculation runs in your browser; nothing you type is uploaded. The tool works offline once the page has loaded.
  • No — it is built for one autosomal gene with two alleles, which is the case every school and first-year syllabus examines. With k alleles there are k(k + 1) ÷ 2 genotype classes and k − 1 independent allele frequencies to estimate, so the Hardy-Weinberg test has k(k − 1) ÷ 2 degrees of freedom (3 for three alleles, as in the ABO blood groups) and the 3.84 critical value no longer applies. Sex-linked genes are also outside its scope, because males carry only one allele at an X-linked locus.

Method & sources

How it computes

Allele frequencies counted directly from observed genotype counts at one autosomal two-allele locus: p = (2·AA + Aa) ÷ 2N and q = (2·aa + Aa) ÷ 2N with N = AA + Aa + aa, so p + q = 1 by construction and no equilibrium is assumed. The Hardy-Weinberg expected counts Np², 2Npq and Nq² are then compared with the observed by χ² = Σ (observed − expected)² ÷ expected on one degree of freedom.

What this tool implements

  • Hardy-Weinberg equilibrium as the null hypothesis: genotype proportions p², 2pq, q² in a large randomly mating population with no selection, mutation, migration or drift (Hardy 1908; Weinberg 1908, published independently the same year).
  • Allele frequencies are COUNTED from genotypes, never inferred from the recessive phenotype via q = √(aa/N). The estimate therefore carries no equilibrium assumption; equilibrium enters only as the expectation being tested.
  • χ² goodness of fit on df = 1, read against the 5% upper critical value 3.841 (rounded to 3.84 on the page). A genotype class with a zero expected count is skipped rather than dividing by zero; no continuity correction is applied and no minimum-expected-count rule is enforced.
  • One autosomal locus with exactly two alleles. Multi-allelic loci — where there are k(k + 1) ÷ 2 genotype classes and k(k − 1) ÷ 2 degrees of freedom — and sex-linked loci are out of scope, and the page says so in its own words.

Sources

  • Hardy GH. Mendelian proportions in a mixed population. Science 1908;28(706):49-50. doi:10.1126/science.28.706.49
  • Weinberg W. Über den Nachweis der Vererbung beim Menschen. Jahreshefte des Vereins für vaterländische Naturkunde in Württemberg 1908;64:369-382. https://www.zobodat.at/pdf/Jh-Ver--vaterl-Naturkunde-Wuerttemberg…
  • Hartl DL, Clark AG. Principles of Population Genetics. 4th ed. Sunderland, MA: Sinauer Associates; 2007. Allele and genotype frequencies, Hardy-Weinberg proportions, and the chi-square test of goodness of fit.
  • NIST/SEMATECH e-Handbook of Statistical Methods, §1.3.6.7.4 Critical values of the chi-square distribution (3.841 at the 5% level for one degree of freedom). https://www.itl.nist.gov/div898/handbook/eda/section3/eda3674.htm

What can make this go out of date

  • None at runtime — the arithmetic is exact and the only published figure on the page is the χ² critical value 3.84, a fixed property of the distribution that does not change.
Advertisement
Pre-footer · AD-W3 728 × 90