Genetic Drift Simulator
Simulate random genetic drift in finite populations to understand how allele frequencies change by chance over generations.
Drift Simulation Results
Trajectory Summary (Final Frequencies)
About Genetic Drift
Genetic drift is random change in allele frequencies due to sampling effects in finite populations. The rate of drift is inversely proportional to population size (N). Expected heterozygosity decays as H(t) = H(0) × (1 - 1/2N)^t. Smaller populations experience faster drift and more rapid loss of genetic variation.
What the Genetic Drift Simulator Does
The genetic drift simulator models how the frequency of a single allele wanders randomly from generation to generation in a finite population. Unlike natural selection, which pushes allele frequencies in a predictable direction, genetic drift is pure chance: when only a limited number of gametes form the next generation, the allele frequency in the offspring will rarely match the parents exactly. This sampling error accumulates, and over enough generations every allele eventually drifts to fixation (frequency 1) or loss (frequency 0).
This simulator runs several independent replicate populations at once so you can watch the spread of possible outcomes. You set four values: the population size (N), the starting allele frequency (p), the number of generations to run, and how many replicate simulations to launch (up to 10). Each generation, the tool draws the next allele count by binomial-style sampling from a pool of 2N gene copies, because every diploid individual carries two alleles at the locus. The result panel reports how many replicates ended in fixation, how many in loss, how many remain polymorphic, the mean final frequency, and the decay of heterozygosity.
Population geneticists, evolutionary biology students, and conservation researchers use a genetic drift calculator like this to build intuition for why small populations lose genetic variation so quickly, why founder events matter, and how effective population size shapes the long-term fate of neutral alleles. The same sampling logic underlies the Wright-Fisher model that anchors most theoretical population genetics.
How the Sampling Model Works
The engine uses the Wright-Fisher idealized population. A diploid population of size N contains 2N copies of the gene. If the current frequency of allele A is p, then the number of A copies that survive into the next generation is drawn from a binomial distribution with 2N trials and success probability p. For computational speed with larger N, the simulator approximates that binomial with a normal distribution that has the same mean and variance, then rounds and clips the count to the valid range of 0 to 2N.
Concretely, each generation the tool computes a mean of 2N·p and a variance of 2N·p·(1−p), takes the standard deviation as the square root of that variance, draws a standard-normal value z using the Box-Muller transform, and sets the next allele count to round(2N·p + z·√variance). The new frequency is that count divided by 2N. Once a replicate hits exactly 0 or 1 it is absorbed — the allele is permanently lost or fixed and the trajectory stays flat.
Because the model has no mutation, migration, or selection, drift is the only evolutionary force at work. That makes the simulator a clean laboratory for the neutral theory: every replicate is equally likely to fix or lose the allele in proportion to its starting frequency.
Per-Generation Drift Sampling and Heterozygosity Decay
Where:
- N= Population size (number of diploid individuals)
- 2N= Total number of gene copies at the locus
- p= Current frequency of the focal allele in a generation
- p₀= Initial allele frequency you enter
- z= Standard normal random draw (Box-Muller transform)
- H(t)= Expected heterozygosity after t generations
- t= Generation number, from 0 to the value you set
Heterozygosity Decay and Drift Variance
Two theoretical quantities help you interpret the random replicates. The first is expected heterozygosity, the probability that two randomly chosen alleles differ. It starts at H(0) = 2·p₀·(1−p₀) and shrinks by the constant factor (1 − 1/(2N)) every generation. The smaller the population, the larger 1/(2N) becomes and the faster heterozygosity collapses — that is the mathematical reason small populations purge variation rapidly.
The second is the theoretical variance in final allele frequency across many replicate populations. The simulator computes it as p₀·(1−p₀)·(1 − (1 − 1/(2N))^t), which approaches the maximum possible variance of p₀·(1−p₀) as t grows large and all replicates fix or lose. The tool also reports the observed variance among the handful of replicates you actually ran; with only a few simulations this observed value is noisy and can differ noticeably from the theory, which is itself a useful lesson about sampling.
The probability that a neutral allele ultimately reaches fixation equals its starting frequency, p₀. So if you start at p = 0.5 and run many replicates, roughly half should fix and half should be lost. The mean final frequency across replicates stays near p₀ on average even as individual populations diverge wildly.
How to Use the Genetic Drift Simulator
Using the genetic drift simulator takes four inputs and a few seconds:
- Population Size (N): Enter the number of diploid individuals, from 2 up to 10,000. Try small values like 10 or 25 to see dramatic drift, and large values like 1,000 to see frequencies stay nearly stable.
- Initial Frequency (p): Set the starting allele frequency between 0 and 1. A value of 0.5 gives the most balanced fixation-versus-loss outcome.
- Generations: Choose how many generations to run, up to 500. More generations give more replicates time to reach an absorbing state.
- Simulations: Pick how many independent replicate populations to launch, up to 10. Each runs with its own random draws.
The results panel then summarizes the outcomes: counts of fixation, loss, and still-polymorphic replicates, the mean final frequency, the initial and expected final heterozygosity, and both theoretical and observed variance. The trajectory chips at the bottom show each replicate's final frequency, color-coded green for fixation, red for loss, and blue for polymorphic. Re-run with the same settings and the random seeds change, so outcomes differ each time — that randomness is the whole point of drift.
Why Genetic Drift Matters in Biology
Genetic drift is one of the four core forces of evolution alongside mutation, migration, and natural selection. It dominates whenever populations are small — during a founder effect, after a population bottleneck, or on isolated islands. Conservation geneticists worry about drift because endangered species with few breeding individuals lose alleles, increase homozygosity, and risk inbreeding depression. A genetic drift calculator makes these abstract risks concrete by showing how fast variation disappears at a given effective population size.
Drift also drives the neutral theory of molecular evolution, which holds that most variation at the DNA level is selectively neutral and changes frequency purely by chance. Understanding the random fixation of neutral mutations underpins the molecular clock used to date evolutionary divergences. In medicine and agriculture, recognizing drift helps explain why rare disease alleles can become common in isolated human populations or small breeding stocks.
By experimenting with population size and starting frequency here, you can reproduce textbook results: doubling N halves the rate of heterozygosity loss, low-frequency alleles are usually lost while common alleles often fix, and replicate populations that start identical can end up genetically very different. These are the same insights that population genetics courses build entire problem sets around.
Worked Examples
Heterozygosity decay in a small population
Problem:
A population of N = 50 starts at allele frequency p₀ = 0.5. What is the expected heterozygosity after 1 generation and after 20 generations?
Solution Steps:
- 1Initial heterozygosity: H(0) = 2 × 0.5 × (1 − 0.5) = 2 × 0.5 × 0.5 = 0.5000
- 2Per-generation decay factor: (1 − 1/(2N)) = 1 − 1/100 = 0.99
- 3After 1 generation: H(1) = 0.5 × 0.99^1 = 0.4950
- 4After 20 generations: H(20) = 0.5 × 0.99^20 = 0.5 × 0.8179 = 0.4090
Result:
Heterozygosity falls from 0.5000 to about 0.4090 over 20 generations, a roughly 18% loss of variation.
Theoretical drift variance after many generations
Problem:
For N = 50, p₀ = 0.5, and 50 generations, compute the theoretical variance in final allele frequency.
Solution Steps:
- 1p₀ × (1 − p₀) = 0.5 × 0.5 = 0.25 (this is the maximum possible variance)
- 2Decay factor raised to t: (1 − 1/100)^50 = 0.99^50 ≈ 0.6050
- 3Variance = 0.25 × (1 − 0.6050) = 0.25 × 0.3950
- 4Variance = 0.0988, which rounds to 0.0988 in the results panel
Result:
The theoretical variance is about 0.0988, meaning replicate populations have spread substantially but have not all reached fixation or loss yet.
Effect of large population size on drift
Problem:
Compare the expected final heterozygosity after 50 generations for N = 50 versus N = 1000, both starting at p₀ = 0.5.
Solution Steps:
- 1Initial heterozygosity for both: H(0) = 2 × 0.5 × 0.5 = 0.5000
- 2Small population N = 50: H(50) = 0.5 × (1 − 1/100)^50 = 0.5 × 0.99^50 ≈ 0.5 × 0.6050 = 0.3025
- 3Large population N = 1000: H(50) = 0.5 × (1 − 1/2000)^50 = 0.5 × 0.9995^50 ≈ 0.5 × 0.9753 = 0.4877
- 4Compare the two final values to see the impact of N
Result:
The small population retains only ~0.30 heterozygosity while the large population retains ~0.49, showing drift is far stronger when N is small.
Fixation probability of a neutral allele
Problem:
If you start a neutral allele at p₀ = 0.2 and run many replicate populations to completion, what fraction are expected to fix the allele?
Solution Steps:
- 1For a neutral allele, the ultimate fixation probability equals its starting frequency p₀
- 2Fixation probability = p₀ = 0.2
- 3Loss probability = 1 − p₀ = 0.8
- 4So out of, say, 10 replicates run long enough, about 2 are expected to fix and about 8 to lose the allele
Result:
About 20% of replicate populations are expected to fix the allele and 80% to lose it, matching the starting frequency of 0.2.
Tips & Best Practices
- ✓Set N very small (10 to 25) to watch alleles fix or be lost within just a few generations.
- ✓Use p₀ = 0.5 to get the most balanced split between fixation and loss outcomes.
- ✓Increase the number of generations so more replicates reach an absorbing state of 0 or 1.
- ✓Compare observed variance against theoretical variance to see how few replicates create noisy estimates.
- ✓Run a large N (1000+) to confirm that big populations keep allele frequencies nearly flat.
- ✓Remember the long-run fixation probability of a neutral allele equals its starting frequency p₀.
- ✓Re-run the same settings several times to appreciate that drift produces a distribution of outcomes, not one answer.
- ✓Track expected final heterozygosity to quantify how much genetic diversity the population is projected to lose.
Frequently Asked Questions
Sources & References
Last updated: 2026-06-05
Help us improve!
How would you rate the Genetic Drift Simulator?
Editorial Note
MyCalcBuddy Editorial Team
This page is maintained as an educational calculator reference.
Formula Source: Standard Mathematical References
by Various