Code tool

Hardy–Weinberg Calculator

Derive allele and genotype frequencies from a recessive phenotype fraction under ideal equilibrium, with optional expected counts.

In-browser processingNo account requiredPrivacy details ↗

Enter recessive phenotype fraction q² from 0 to 1, and optionally a population size N: integer 1–1,000,000,000. This two-allele diploid model assumes that the recessive phenotype identifies aa exactly, random mating, a sufficiently large population, and no selection, mutation or migration. q=√(q²), p=1−q; AA=p², Aa=2pq, aa=q². Expected counts equal frequency×N and may be fractional; they are not observed counts. This does not test equilibrium or provide medical or genetic diagnosis.

Inputs stay in this browser; nothing is sent.

A QUICK WALKTHROUGH

How to use this tool

  1. Enter the values and choose their units.
  2. Enter recessive phenotype fraction q² from 0 to 1, and optionally a population size N: integer 1–1,000,000,000. This two-allele diploid model assumes that the recessive phenotype identifies aa exactly, random mating, a sufficiently large population, and no selection, mutation or migration. q=√(q²), p=1−q; AA=p², Aa=2pq, aa=q². Expected counts equal frequency×N and may be fractional; they are not observed counts. This does not test equilibrium or provide medical or genetic diagnosis.
  3. Review the calculated result.

Formula and assumptions

Enter recessive phenotype fraction q² from 0 to 1, and optionally a population size N: integer 1–1,000,000,000. This two-allele diploid model assumes that the recessive phenotype identifies aa exactly, random mating, a sufficiently large population, and no selection, mutation or migration. q=√(q²), p=1−q; AA=p², Aa=2pq, aa=q². Expected counts equal frequency×N and may be fractional; they are not observed counts. This does not test equilibrium or provide medical or genetic diagnosis.

Inputs stay in this browser; nothing is sent.

Inputs stay in this browser; nothing is sent.

GOOD TO KNOW

Common questions

How is the result calculated?

Enter recessive phenotype fraction q² from 0 to 1, and optionally a population size N: integer 1–1,000,000,000. This two-allele diploid model assumes that the recessive phenotype identifies aa exactly, random mating, a sufficiently large population, and no selection, mutation or migration. q=√(q²), p=1−q; AA=p², Aa=2pq, aa=q². Expected counts equal frequency×N and may be fractional; they are not observed counts. This does not test equilibrium or provide medical or genetic diagnosis.