Hardy-Weinberg Equilibrium Calculator
Get allele and genotype frequencies from observed counts or a known p, then test the population against Hardy-Weinberg equilibrium with a chi-square test.
Expected genotypes — p² + 2pq + q² = 1
| Genotype | Expected freq. | Expected count | Observed | (O−E)²/E |
|---|---|---|---|---|
| AA | 0.36 | 36 | 36 | 0 |
| Aa | 0.48 | 48 | 48 | 0 |
| aa | 0.16 | 16 | 16 | 7.8886e-31 |
- p = (2 × AA + Aa) ÷ (2 × 100) = 0.6, and q = 1 − p = 0.4.
- Carrier frequency 2pq = 0.48 — about 48 in every 100 individuals carry one copy of a without showing the recessive phenotype.
- Expected counts are the frequencies multiplied by the population of 100.
Chi-square goodness-of-fit test
χ² = 7.8886e-31 gives p = 1, which is not below α = 0.05. There is no evidence that this population departs from Hardy-Weinberg equilibrium.
| α | Critical χ² (df 1) | Your χ² |
|---|---|---|
| 0.1 | 2.706 | below — fits |
| 0.05 | 3.841 | below — fits |
| 0.01 | 6.635 | below — fits |
| 0.001 | 10.828 | below — fits |
One degree of freedom: three genotype classes minus one for the total, minus one more for the allele frequency estimated from the same data.
Hardy-Weinberg equilibrium is a null model, not a law. It holds only for a large, randomly mating population with no mutation, migration or selection acting on the locus, and for an autosomal gene with two alleles. Finding that a population fits does not prove those assumptions are true — several of them can cancel out — and finding that it deviates only tells you at least one is being violated, not which.
What is the Hardy-Weinberg Equilibrium Calculator?
Hardy-Weinberg equilibrium says allele frequencies p and q sum to 1 and genotype frequencies follow p squared plus 2pq plus q squared. With p at 0.6 in 100 individuals, expect 36 homozygous dominant, 48 heterozygous and 16 homozygous recessive.
- Works from observed genotype counts or from a known allele frequency
- Expected genotype frequencies and counts from p squared plus 2pq plus q squared
- Chi-square goodness-of-fit test with one degree of freedom and an exact p-value
- Adjustable significance level, with a table of standard critical values
- Carrier frequency 2pq reported separately
- Warns when an expected count falls below 5, where chi-square is unreliable
How to use the Hardy-Weinberg Equilibrium Calculator
- 1
Choose whether you are starting from observed genotype counts or a known allele frequency.
- 2
Set the allele symbols so the output matches your notation.
- 3
Enter the three genotype counts, or enter p and a population size.
- 4
Read p, q, the carrier frequency and the expected genotype table.
- 5
Check the chi-square panel for the test statistic, p-value and verdict against your alpha.
About the Hardy-Weinberg Equilibrium Calculator
The ByteTools Hardy-Weinberg Equilibrium Calculator works in both directions. Give it observed genotype counts and it estimates the allele frequencies p and q, predicts the expected counts under equilibrium, and runs a chi-square goodness-of-fit test with one degree of freedom to say whether the difference is more than chance would explain. Give it a known allele frequency instead and it simply projects the expected genotype numbers for a population of any size.
Carrier frequency, the 2pq term, is called out on its own because it is usually the figure people actually want — how many people carry one copy of a recessive allele without showing the trait. Allele symbols are editable, so the output reads in the notation your course or paper uses.
The p-value comes from the exact chi-square distribution for one degree of freedom and matches published critical values: 3.841 gives 0.05, and 6.635 gives 0.01. Everything runs in your browser, nothing is uploaded, and the page is clear that equilibrium is a null model whose assumptions can cancel out rather than a law populations obey.
Frequently asked questions
What are the Hardy-Weinberg equations?
There are two: p plus q equals 1 for the allele frequencies, and p squared plus 2pq plus q squared equals 1 for the genotype frequencies. The first says every allele is one of the two; the second follows from random mating and gives the expected proportions of each genotype.
How do you calculate allele frequency from genotype counts?
p equals twice the homozygous dominant count plus the heterozygous count, all divided by twice the total number of individuals. Each person carries two alleles, so a homozygote contributes two copies and a heterozygote one. q is then simply 1 minus p.
Why does the chi-square test have one degree of freedom?
Three genotype classes give two degrees of freedom after fixing the total, and one more is lost because the allele frequency was estimated from the same data. That leaves one, which is why the critical value to beat at the 5 percent level is 3.841.
What does it mean if a population is not in Hardy-Weinberg equilibrium?
At least one assumption is being violated — non-random mating, selection, migration, mutation or a small population size. The test cannot tell you which, and it can also miss violations that happen to cancel out, so a good fit is not proof that nothing is going on.
What is carrier frequency and how do I find it?
It is the 2pq term: the proportion of individuals carrying one copy of the recessive allele without showing the trait. For a rare recessive disease it is far higher than the frequency of affected people, which is why carrier screening finds so many more people than the disease itself does.
Related tools
Punnett Square Calculator
Build monohybrid and dihybrid Punnett squares from two parent genotypes and get the genotype and phenotype ratios with percentages for every outcome.
DNA Codon Translator
Translate a DNA or mRNA sequence into protein across three or six reading frames, with start and stop codons marked and the longest ORF listed.
GC Content Calculator
Count A, C, G and T in a sequence to get GC content, AT content and the GC/AT ratio, plus primer melting temperature and a sliding-window GC profile.
Percentage Calculator
Calculate what X% of a number is, what percent one number is of another, and percentage increase or decrease between two values — instantly and free.
DNA to RNA Converter
Transcribe DNA to mRNA, get the complement and reverse complement, translate codons to protein and see GC content — all in your browser.