Skip to main content
biology

Hardy-Weinberg Calculator

Calculate allele and genotype frequencies in a population using the Hardy-Weinberg equilibrium principle. Essential for population genetics.

Reviewed by Christopher FloiedPublished Updated

This free online hardy-weinberg calculator provides instant results with no signup required. All calculations run directly in your browser — your data is never sent to a server. Enter your values below and see results update in real time as you type. Perfect for everyday calculations, homework, or professional use.

Minimum: 0

Results

Homozygous Dominant (p²)

0.49

Heterozygous (2pq)

0.42

Homozygous Recessive (q²)

0.09

Recessive Allele Frequency (q)

0.3

How to Use This Calculator

1

Enter your input values

Fill in all required input fields for the Hardy-Weinberg Calculator. Most fields include unit selectors so you can work in your preferred unit system — metric or imperial, whichever matches your problem.

2

Review your inputs

Double-check that all values are correct and that you have selected the right units for each field. Incorrect units are the most common source of calculation errors and can produce results that are off by factors of 2, 10, or more.

3

Read the results

The Hardy-Weinberg Calculator instantly computes the output and displays results with units clearly labeled. All calculations happen in your browser — no loading time and no data sent to a server.

4

Explore parameter sensitivity

Try adjusting individual input values to see how the output changes. This is a quick and effective way to develop intuition about how different parameters influence the result and to identify which inputs have the largest effect.

Formula Reference

Hardy-Weinberg Calculator Formula

See calculator inputs for the governing equation

Variables: All variables and their units are labeled in the calculator interface above. Input fields accept values in multiple unit systems — select your preferred unit from the dropdown next to each field.

When to Use This Calculator

  • Use the Hardy-Weinberg Calculator when you need accurate results quickly without the risk of manual computation errors or unit conversion mistakes.
  • Use it to verify calculations made by hand or in spreadsheets — an independent check can catch errors before they lead to costly decisions.
  • Use it to explore how changing input parameters affects the output — a quick way to develop intuition and identify the most influential variables.
  • Use it when collaborating with others to ensure everyone is working from the same numbers and applying the same assumptions.

About This Calculator

The Hardy-Weinberg Calculator is a free, browser-based calculation tool for engineers, students, and technical professionals. Calculate allele and genotype frequencies in a population using the Hardy-Weinberg equilibrium principle. Essential for population genetics. It implements standard formulas and supports both metric (SI) and imperial unit systems with automatic unit conversion. All calculations are performed instantly in your browser with no data sent to a server. Use this calculator as a quick reference and sanity-check tool during design, analysis, and learning. Always verify results against primary engineering references and applicable standards for any safety-critical application.

About Hardy-Weinberg Calculator

The Hardy-Weinberg Calculator is the foundation of population genetics, allowing you to calculate allele and genotype frequencies in an idealized population. The Hardy-Weinberg principle, formulated independently by G.H. Hardy and Wilhelm Weinberg in 1908, states that allele and genotype frequencies in a population remain constant from generation to generation in the absence of evolutionary forces (mutation, migration, genetic drift, non-random mating, and selection). This calculator helps biology students and researchers understand expected genetic distributions, identify when populations are NOT in equilibrium (suggesting evolution is occurring), and predict carrier frequencies for genetic diseases. Hardy-Weinberg is the null hypothesis against which all evolutionary change is measured.

The Math Behind It

The Hardy-Weinberg principle describes the genetic equilibrium of an idealized population. It provides a baseline against which to measure evolutionary change. **The Equation**: p² + 2pq + q² = 1 Where: - p = frequency of dominant allele (A) - q = frequency of recessive allele (a) - p² = frequency of homozygous dominant (AA) - 2pq = frequency of heterozygous (Aa) - q² = frequency of homozygous recessive (aa) Also: p + q = 1 **Hardy-Weinberg Assumptions**: For a population to be in equilibrium, ALL of these must be true: 1. **No mutation** — alleles aren't changing 2. **No migration** — no individuals entering/leaving 3. **Large population** — no genetic drift 4. **Random mating** — no preference for genotypes 5. **No selection** — all genotypes equally fit Real populations rarely meet all conditions, but H-W is still useful as a baseline. **Why It Matters**: 1. **Expected vs Observed**: Compare observed genotype frequencies to H-W predictions. Differences suggest evolution is occurring. 2. **Carrier Frequency**: For autosomal recessive diseases, you can calculate how many people carry one copy of the disease allele. 3. **Allele Frequency Estimation**: From phenotype frequencies (visible traits), estimate allele frequencies in the population. **Calculating Allele Frequencies**: If you can count phenotypes: - Recessive phenotype frequency = q² - So q = √(q²) - And p = 1 - q **Example: Cystic Fibrosis**: In the US, about 1 in 2,500 newborns has CF (autosomal recessive). - q² = 1/2500 = 0.0004 - q = √0.0004 = 0.02 - p = 1 - 0.02 = 0.98 - Carrier frequency: 2pq = 2 × 0.98 × 0.02 = 0.039 ≈ 1 in 25 **This is the power of Hardy-Weinberg**: from disease incidence, we calculate that 1 in 25 people are carriers (heterozygotes) without ever testing them! **Common Disease Carrier Frequencies**: | Disease | q² (incidence) | 2pq (carrier rate) | |---------|----------------|---------------------| | Cystic Fibrosis | 1/2500 | 1/25 | | Sickle Cell (in W. Africa) | 1/100 | 1/5.5 | | Tay-Sachs (Ashkenazi) | 1/3600 | 1/30 | | PKU | 1/15,000 | 1/65 | **When Hardy-Weinberg is Violated**: 1. **Selection**: Some genotypes survive/reproduce more 2. **Genetic drift**: Random sampling in small populations 3. **Mutation**: New alleles appearing 4. **Migration**: Gene flow between populations 5. **Non-random mating**: Assortative mating, inbreeding Detecting H-W deviations is how we DETECT evolution. **Heterozygote Advantage Example**: Sickle cell anemia (HbS) is interesting: - Homozygous SS: severe disease, often fatal - Heterozygous AS: mild symptoms, malaria resistance - Homozygous AA: normal, but susceptible to malaria In malaria-endemic regions, heterozygotes have HIGHER fitness than either homozygote. This 'balanced polymorphism' maintains both alleles despite the cost. **Limitations**: 1. Real populations aren't infinite 2. Random mating doesn't always occur 3. Selection is usually present 4. Models simple two-allele systems best 5. X-linked genes follow different equations Despite these, H-W remains the cornerstone of population genetics.

Formula Reference

Hardy-Weinberg Equation

p² + 2pq + q² = 1

Variables: p = dominant allele freq, q = recessive allele freq

Allele Sum

p + q = 1

Variables: Allele frequencies must sum to 1

Worked Examples

Example 1: Calculating Genotype Frequencies

In a population, the dominant allele frequency p = 0.7. What are the genotype frequencies?

Step 1:p = 0.7, so q = 1 - 0.7 = 0.3
Step 2:p² = 0.7² = 0.49 (49% homozygous dominant AA)
Step 3:2pq = 2 × 0.7 × 0.3 = 0.42 (42% heterozygous Aa)
Step 4:q² = 0.3² = 0.09 (9% homozygous recessive aa)
Step 5:Check: 0.49 + 0.42 + 0.09 = 1.0 ✓

49% AA, 42% Aa, 9% aa. The recessive trait will appear in 9% of the population, but 42% are carriers.

Example 2: Carrier Frequency from Disease Rate

A genetic disease affects 1 in 10,000 people. What's the carrier frequency?

Step 1:q² = 1/10000 = 0.0001
Step 2:q = √0.0001 = 0.01
Step 3:p = 1 - 0.01 = 0.99
Step 4:Carrier frequency 2pq = 2 × 0.99 × 0.01 = 0.0198 ≈ 0.02 or 2%

Even though only 1 in 10,000 have the disease, about 1 in 50 people (2%) carry the allele. This is why disease-screening matters even for rare conditions.

Common Mistakes & Tips

  • !Forgetting that p² is the dominant homozygote frequency, not the dominant allele frequency. p is the allele frequency.
  • !Confusing dominant phenotype with homozygous dominant. The dominant phenotype includes both AA and Aa.
  • !Adding the heterozygous frequency without the factor of 2. There are two ways to be heterozygous.
  • !Applying Hardy-Weinberg when assumptions are clearly violated (e.g., very small populations or strong selection).

Related Concepts

Used in These Calculators

Calculators that build on or apply the concepts from this page:

Frequently Asked Questions

Why is Hardy-Weinberg called 'equilibrium'?

Because under the assumed conditions, allele frequencies remain CONSTANT from one generation to the next — they're at equilibrium. Without evolutionary forces, p stays p and q stays q forever. The equilibrium is reached after one generation of random mating, regardless of the starting genotype frequencies. The genetic 'state' of the population doesn't change over time.

Can a population be in Hardy-Weinberg equilibrium?

Approximately, yes, but never perfectly. Real populations always experience some mutation, selection, migration, and drift. However, for traits where these forces are weak, populations can be CLOSE to equilibrium. This is why we treat H-W as a 'null hypothesis' — we expect deviations and look for them as evidence of evolution.

How do I calculate allele frequencies from observed genotypes?

If you observe AA, Aa, and aa frequencies: p = (2 × AA + Aa) / (2 × total), and q = 1 - p. The factor of 2 accounts for AA having TWO dominant alleles, while Aa has one. This gives you allele frequencies that you can then plug into H-W to test if observed = expected.

What if the trait is X-linked?

X-linked genes use modified Hardy-Weinberg equations because males have only one X chromosome (and thus only one allele). For X-linked recessive: female frequency q² (homozygous), but male frequency q (just need one allele). This is why X-linked recessive diseases (like color blindness, hemophilia) are much more common in males.