(function(){try{var t=localStorage.getItem('theme');if(!t){t=window.matchMedia('(prefers-color-scheme: dark)').matches?'dark':'light';}document.documentElement.setAttribute('data-theme',t);}catch(e){}})();

Free Hardy-Weinberg Calculator




Worked example

Worked example: 320 AA, 160 Aa, 20 aa. N = 500, p = (640+160)/1000 = 0.8, q = 0.2. Expected: 320, 160, 20 at equilibrium; the chi-square then tests how far your counts actually sit from those numbers.

The formula

The formulae: p² + 2pq + q² = 1 (Hardy-Weinberg, 1908), with p = (2×AA + Aa)/(2N) from observed counts and the χ² goodness-of-fit test at one degree of freedom.

Questions people ask

What does equilibrium mean here?

In a large, randomly mating population with no selection, mutation, migration or drift, allele frequencies stay constant and genotypes settle to p², 2pq, q².

Why one degree of freedom?

Three genotype classes minus one for the total minus one because p was estimated from the data leaves one degree of freedom.

Can I enter frequencies instead of counts?

This version takes counts so it can run the chi-square. If you only know frequencies, multiply by any common sample size to approximate.

Share this free tool
XFacebookRedditWhatsAppEmail