About Hardy-Weinberg Calculator
The Hardy-Weinberg principle describes the genotype frequencies a population settles into when nothing is changing it: random mating, no selection, mutation, migration or drift, and a large population. Under those conditions allele frequencies stay constant and genotypes follow p², 2pq and q², which is why the model is used as a baseline for spotting evolution in action.
This calculator works in both directions. Give it allele frequencies p and q to get genotype frequencies and expected counts for a population size, or give it genotype counts to recover p and q and compare the observed counts with the Hardy-Weinberg expectation using a chi-square hint.
What this tool does
Both input directions
Start from allele frequencies p and q or from genotype counts and frequencies for AA, Aa and aa; each direction derives the other.
p², 2pq and q²
Expected genotype frequencies are shown with the arithmetic written out, including the 2pq heterozygote term.
Expected counts for a population
Add a population size N to turn the frequencies into expected genotype counts, or use the observed total when counts are entered.
Observed versus expected
Genotype counts are compared side by side with expected counts, with a χ² statistic and p-value as a rough Hardy-Weinberg check.
Normalisation and validation
Frequencies that do not sum to 1 are normalised with a note, and negative, non-numeric or impossible values are rejected with a clear message.
Assumptions listed
The full assumption list is shown with the result, so it is clear what a deviation from the expectation would mean.
How to use Hardy-Weinberg Calculator
- 01
Choose the input mode
Pick allele frequencies when you know p and q, or genotype data when you have counts or frequencies for AA, Aa and aa.
- 02
Enter the frequencies or genotype data
Allele frequencies must be between 0 and 1; genotype counts are whole numbers and genotype frequencies are proportions.
- 03
Set a population size if you need counts
N is optional in allele and frequency modes; in counts mode the observed total is used automatically.
- 04
Read the expected frequencies and counts
The table gives the Hardy-Weinberg frequency p², 2pq or q² and the matching expected count for each genotype.
- 05
Compare observed with expected
With genotype counts, check the observed column and the χ² hint, then confirm the assumptions before drawing a conclusion.
How this tool works
- Works with
- ALLELES → HWE
- Processing
- Client-side, in your browser. Nothing is uploaded.
- Requirements
- Chrome, Edge, Firefox or Safari · JavaScript enabled
Limitations worth knowing
- Models a single locus with two alleles and assumes random mating, no selection, mutation, migration or drift, and a large population; multi-allelic and multi-locus cases are out of scope.
- The chi-square hint is only reliable when expected counts are reasonably large; with small counts it is a rough indication and an exact test may be preferable.
- Normalising frequencies that do not sum to 1 changes the values slightly, so entering correct proportions is always better than relying on normalisation.
Privacy and file handling
The allele frequencies and genotype counts you enter stay in this browser tab. The expected frequencies, counts and chi-square hint are calculated with JavaScript on your device, so nothing is uploaded, stored or logged, and closing the page discards the input.
Read the full privacy policy