HomeGenetics & EvolutionMendelian Genetics

🧬 Mendelian Genetics

Interactive Mendelian genetics simulator. Build Punnett squares for monohybrid and dihybrid crosses, explore dominant/recessive inheritance, ABO blood types, Hardy-Weinberg equilibrium, and observe phenotypic ratios.

Genetics & Evolution3DEasy60 FPS
mendelian-genetics ↗ Open standalone

About Mendelian Genetics

This simulator builds Punnett squares to predict how alleles are inherited. It models monohybrid crosses (one gene, such as P/p flower colour), dihybrid crosses (two independent genes, P/p with T/t), and Hardy–Weinberg equilibrium for whole populations. Each gamete carries one allele per locus; the square combines parental gametes to enumerate every equally likely offspring genotype, from which phenotype ratios such as the classic 3:1 and 9:3:3:1 emerge.

Choose a cross type tab and a trait (flower, height, eye colour, ABO blood type or a custom A/a gene), then set each parent's two alleles. "Run Cross" draws the Punnett grid and ratios; "Simulate 200" samples 200 random offspring to show how real counts scatter around the predicted ratio. The Hardy–Weinberg tab uses sliders for allele frequency p and population size N. Such modelling underpins genetic counselling, crop breeding and conservation biology.

Frequently Asked Questions

What is a Punnett square?

A Punnett square is a grid that lists all the gametes one parent can produce along the top and the other parent's gametes down the side. Each interior cell combines one gamete from each parent into a possible offspring genotype. Because the gametes are equally likely, the proportion of cells showing each genotype gives the expected ratio of offspring.

What is the difference between a monohybrid and a dihybrid cross?

A monohybrid cross follows a single gene, producing a 2×2 square with four cells, and a heterozygous cross (Pp × Pp) gives the familiar 3:1 phenotype ratio. A dihybrid cross follows two independent genes at once, producing a 4×4 square of sixteen cells; PpTt × PpTt yields the 9:3:3:1 ratio when the two genes assort independently.

What do dominant and recessive mean here?

A dominant allele (written with a capital, such as P or T) masks the effect of a recessive allele (lower case, such as p or t) in a heterozygote. So Pp and PP both look purple, while only pp shows the white recessive phenotype. The simulator colours each cell by phenotype so you can immediately see which genotypes share an appearance.

How do I set up a cross in this simulator?

Pick a cross-type tab (Monohybrid, Dihybrid or Hardy–Weinberg) and a trait from the dropdown. For mono and dihybrid crosses, use the allele dropdowns to set each of Parent 1 and Parent 2's two alleles, then press "Run Cross". The square, phenotype colours and offspring ratios update automatically whenever you change an allele.

What does the "Simulate 200" button do?

It performs a stochastic sampling: for each of 200 offspring it randomly picks one allele from each parent (a 50/50 coin flip per parent) and records the resulting phenotype. The bar chart of these counts shows how observed frequencies cluster around, but rarely land exactly on, the theoretical 3:1 or other ratio — illustrating sampling variation in real families and breeding experiments.

What is the Hardy–Weinberg equation?

For a single gene with two alleles at frequencies p and q (where p + q = 1), the equilibrium genotype frequencies are p² for homozygous dominant, 2pq for heterozygous, and q² for homozygous recessive, and these sum to 1. The Hardy–Weinberg tab plots these three frequencies against p and converts them into approximate individual counts for your chosen population size N.

What assumptions does Hardy–Weinberg equilibrium require?

The equilibrium holds only for an idealised population with random mating, no mutation, no natural selection, no migration and infinitely large size (no genetic drift). Real populations violate these to some degree, so observed deviations from p², 2pq and q² are used as evidence that one of these evolutionary forces is acting on a gene.

How are ABO blood types modelled?

The ABO trait uses three alleles: IA and IB are codominant with each other, while i is recessive to both. So IAIA and IAi give type A, IBIB and IBi give type B, IAIB gives type AB because both alleles are expressed, and ii gives type O. This shows that not every gene fits the simple two-allele dominant–recessive pattern.

Are the eye-colour and other traits biologically accurate?

The plant traits (flower colour and height) closely match Mendel's original pea experiments and are genuinely single-gene. The human eye-colour example is a deliberate simplification: real eye colour is polygenic, influenced by several genes, so the clean brown-over-blue model is a teaching device rather than a complete description.

Why don't simulated offspring exactly match the predicted ratio?

The Punnett square gives expected probabilities, not guaranteed outcomes. Because fertilisation is random, a finite sample of 200 offspring will show statistical scatter around the ideal ratio. Larger samples converge closer to the predicted proportions, which is why geneticists rely on large counts and statistical tests rather than a handful of individuals.

⚙ Under the hood

Interactive Punnett squares, dihybrid crosses and Hardy-Weinberg equilibrium.

3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)