Hwe Calculator

Use this Hwe Calculator to compare observed AA, Aa, and aa counts with Hardy-Weinberg expected counts. It returns p, q, expected genotypes, chi-square, and HWE status.

Frequency of ‘A’ allele (p)
Frequency of ‘a’ allele (q)
Expected AA (p² × N)
Expected Aa (2pq × N)
Expected aa (q² × N)
Chi-Square Statistic (χ²)
Equilibrium Status
By: AxisCalc Published: March 28, 2026 Reviewed by: Elena Rostova

This calculator tests whether observed genotype counts fit Hardy-Weinberg equilibrium for a given population. You simply enter the observed numbers for the AA, Aa, and aa genotypes. The tool returns the allele frequencies p and q, the expected genotype counts, the chi-square value, and the final equilibrium status. This tool works for bi-allelic traits only.

What this Hwe Calculator returns

Here is exactly what the calculator determines from your observed genotype counts.

OutputMeaningFormula / basis
Allele frequency pFrequency of allele A in the sample$p = \frac{2AA + Aa}{2N}$
Allele frequency qFrequency of allele a in the sample$q = 1 – p$
Expected AAExpected homozygous dominant count under HWE$p^2 \times N$
Expected AaExpected heterozygous count under HWE$2pq \times N$
Expected aaExpected homozygous recessive count under HWE$q^2 \times N$
Chi-square ($\chi^2$)The statistical difference between observed and expected counts$\sum \frac{(O-E)^2}{E}$
Equilibrium statusWhether the observed genotype counts are consistent with Hardy-Weinberg equilibriumCompares $\chi^2$ to the critical value (3.841)

Inputs required for this Hwe Calculator

To use the tool, you need to provide the actual number of individuals for each genotype in your sample.

InputFormatMeaning
Observed AAWhole numberTotal counted individuals with the homozygous dominant genotype
Observed AaWhole numberTotal counted individuals with the heterozygous genotype
Observed aaWhole numberTotal counted individuals with the homozygous recessive genotype

The calculator accepts whole-number genotype counts only, uses no direct p/q values, allows no percentages, and accepts no multi-allele input.

How this Hwe Calculator works

The tool follows a standard Hardy-Weinberg calculation sequence to compare observed genotype counts with expected genotype counts.

Step 1: Calculate total population size $$N = AA + Aa + aa$$

Step 2: Calculate allele frequencies $p = \frac{2AA + Aa}{2N}$ $q = 1 – p$

Step 3: Calculate expected genotype counts $AA = p^2 \times N$ $Aa = 2pq \times N$ $aa = q^2 \times N$

Step 4: Calculate chi-square $$\chi^2 = \sum \frac{(O-E)^2}{E}$$

Step 5: Determine equilibrium status The tool checks the final chi-square value against the critical threshold. It returns “consistent with HWE” if the number is low, or “deviates from HWE” if the difference is statistically significant. A warning appears when any expected counts fall below 5, as small theoretical groups can make the statistical test less reliable.

Hardy-Weinberg formulas used in this calculator

These are the core mathematical expressions the tool relies on to process your inputs.

FormulaMeaningUsed for
$p + q = 1$Total allele frequency across the two allelesFinding the second allele frequency once the first is known
$p^2$The frequency of the homozygous dominant genotypePredicting the expected AA population fraction
$2pq$The frequency of the heterozygous genotypePredicting the expected Aa population fraction
$q^2$The frequency of the homozygous recessive genotypePredicting the expected aa population fraction
$p = \frac{2AA + Aa}{2N}$Allele A frequency from observed countsFinding the exact starting p value from observed counts
$\chi^2 = \sum \frac{(O-E)^2}{E}$The sum of squared differences divided by expected valuesMeasuring how far observed counts drift from expected counts

Example calculation from observed AA, Aa, and aa counts

Here is how the calculator processes a sample population of 100 individuals.

Observed counts: AA = 36 Aa = 48 aa = 16

1. Total population $N = 36 + 48 + 16 = 100$

2. Allele frequencies $p = \frac{2(36) + 48}{2(100)} = \frac{120}{200} = 0.6$ $q = 1 – 0.6 = 0.4$

3. Expected genotype counts Expected AA $= 0.6^2 \times 100 = 36$ Expected Aa $= 2(0.6)(0.4) \times 100 = 48$ Expected aa $= 0.4^2 \times 100 = 16$

4. Chi-square $$\chi^2 = \frac{(36-36)^2}{36} + \frac{(48-48)^2}{48} + \frac{(16-16)^2}{16} = 0 + 0 + 0 = 0$$

5. Final result Because the chi-square value is below 3.841, the population is consistent with Hardy-Weinberg equilibrium.

Interpreting p, q, expected counts, and chi-square

These outputs show how the observed genotype counts compare with Hardy-Weinberg expectations.

ResultWhat it indicatesHow to read it
$p > q$The dominant allele is more commonAllele A is more common in the sample
$q > p$The recessive allele is more commonAllele a is more common in the sample
observed counts close to expectedObserved counts are close to Hardy-Weinberg expectationsThe sample is consistent with Hardy-Weinberg equilibrium
large $\chi^2$The population deviates from equilibriumObserved genotype counts differ more strongly from Hardy-Weinberg expectations
expected count warning below 5The statistical test might be inaccurateThe sample size is too small for a highly reliable chi-square result
fixed allele / no variation detectedOne allele frequency is 1.0 (100%)Every individual in the population has the exact same genotype for this trait

Limits of this Hwe Calculator

This tool is built strictly for standard Hardy-Weinberg testing and has a few specific boundaries.

LimitationWhat it means here
bi-allelic onlyThe tool only works for genes with exactly two alleles
observed genotype counts onlyYou cannot enter allele frequencies directly to work backward
whole-number counts requiredThe calculator does not process decimals or fractions as inputs
small expected counts can weaken chi-squareIf any expected group falls below 5, the math becomes less trustworthy
fixed allele edge caseIf a population has only one genotype, the equilibrium test becomes unnecessary
not for offspring cross predictionThis measures an existing population, it does not act as a Punnett square

Hwe Calculator vs related genetics tools

Choosing the right calculator depends on the exact genetics problem you need to solve.

ToolUse it whenDo not use it when
Hwe CalculatorTesting whether observed genotype counts are consistent with Hardy-Weinberg equilibriumPredicting the exact traits of a single offspring
Punnett square calculatorFinding genotype probabilities for a specific mating crossTesting whether observed population counts are consistent with Hardy-Weinberg equilibrium
Mendelian chi-square calculatorChecking if offspring match standard inheritance ratiosTesting for Hardy-Weinberg equilibrium in a random mating population

Related Tools & Calculators: