Genetic drift can occur in a population that is described by Hardy–Weinberg proportions at a given locus, but it cannot occur under the full set of Hardy–Weinberg assumptions, because one of those assumptions is an infinitely large population—and drift is the random change in allele frequencies that arises precisely because real populations are finite.

The question contains an ambiguity worth resolving first. "Can genetic drift occur in Hardy–Weinberg?" could mean (a) can drift happen in a population whose genotype frequencies happen to match Hardy–Weinberg expectations, or (b) can drift happen while the Hardy–Weinberg conditions are all satisfied? The answer to (a) is yes; the answer to (b) is no. The Hardy–Weinberg principle is a null model: it specifies the conditions under which allele and genotype frequencies do not change. Drift is one of the principal reasons they do change in real populations.

What the Hardy–Weinberg principle actually states

The Hardy–Weinberg principle describes the relationship between allele frequencies and genotype frequencies at a single locus in a randomly mating population, and it predicts that both remain constant from generation to generation when a specific set of conditions holds. For a locus with two alleles, A and a, at frequencies p and q (with p + q = 1), the expected genotype frequencies after one generation of random mating are:

AA: p² Aa: 2pq aa: q²

These proportions are the Hardy–Weinberg proportions. The principle is often stated as five assumptions:

1: No selection (all genotypes have equal survival and reproductive success). 2: No mutation. 3: No migration (no gene flow into or out of the population). 4: Random mating with respect to the locus. 5: An infinitely large population (no genetic drift).

The fifth condition is the one that directly excludes drift. If a population is infinite, sampling variation in allele frequencies across generations is zero by definition, so allele frequencies cannot wander. In any finite population, the gametes that form the next generation are a sample of the parental gene pool, and samples deviate from their source. That sampling deviation is genetic drift.

Why finite population size makes drift unavoidable

Imagine a locus with two alleles at frequencies p = 0.5 and q = 0.5, in a population of N diploid individuals, so there are 2N gene copies. If N = 10,000, the next generation draws 20,000 gene copies. The expected frequency of A remains 0.5, but the realized frequency will fluctuate around 0.5 with a standard deviation of roughly √(pq/2N) = √(0.25/20,000) ≈ 0.0035. That is a small but nonzero wobble. If N = 10, the standard deviation is √(0.25/20) ≈ 0.112—over 11 percentage points. Over many generations these fluctuations accumulate, and allele frequencies can wander far from their starting values, including to fixation (p = 1) or loss (p = 0).

The key distinction is between expected frequencies and realized frequencies. Hardy–Weinberg gives the expected genotype proportions under random mating given the current allele frequency. Drift changes the allele frequency itself, so it moves the target that Hardy–Weinberg proportions are computed from. A population can be in Hardy–Weinberg proportions at a locus (genotypes match p², 2pq, q²) and still be drifting, because the allele frequency p is changing between generations. The proportions describe the genotype composition conditional on p; they do not freeze p.

A concrete illustration

Consider a small isolated population of 8 diploid individuals (16 gene copies) with a neutral locus, initially p = 0.5. Random mating produces offspring whose genotype frequencies are close to Hardy–Weinberg proportions in expectation. But suppose, by chance, only 6 of the 16 gene copies passed to the next generation are A. The new p is 0.375. The next generation's Hardy–Weinberg expectations are now computed with p = 0.375, giving AA ≈ 0.141, Aa ≈ 0.469, aa ≈ 0.391. The population may again be near Hardy–Weinberg proportions—but the allele frequency has changed. That change is drift, and it happened in a population that is, at each generation, approximately in Hardy–Weinberg proportions.

This is why textbook treatments sometimes say drift "violates" Hardy–Weinberg: the constancy prediction fails. But the proportions prediction can still hold approximately at any given moment. These are two separate claims, and conflating them causes much of the confusion around this question.

Where the confusion comes from

Several sources of confusion are worth separating.

The principle is a null model, not a description of reality. Hardy–Weinberg is the genetics analogue of a frictionless plane in physics. It tells you what happens when nothing perturbs the system, which is useful precisely because it lets you detect and measure the perturbations—selection, drift, migration, mutation, nonrandom mating—when observed frequencies depart from expectation.

"In Hardy–Weinberg" is loose language. Populations are not "in Hardy–Weinberg"; loci are, at particular times, approximately in Hardy–Weinberg proportions. A population can be in equilibrium at one locus and not another, and the equilibrium can be disturbed at any time by drift, selection, or migration.

Drift and Hardy–Weinberg proportions are not mutually exclusive at a single snapshot. As shown above, a finite population can have genotype frequencies very close to p², 2pq, q² while p itself is drifting. What cannot happen is drift while the infinite-population assumption holds, because that assumption eliminates the sampling variance that drift requires.

Drift is strongest where Hardy–Weinberg assumptions are most strained. Small population size—the condition that most directly violates the infinite-population assumption—is also the condition under which drift is most powerful. Conservation genetics and population genetics routinely use this: a small effective population size means drift dominates over selection for weakly selected alleles, and heterozygosity erodes over time.

What drift does to Hardy–Weinberg proportions over time

Even though a population can be near Hardy–Weinberg proportions at any one generation, drift has a systematic effect across generations: it reduces heterozygosity. In a finite population of effective size Ne, the expected heterozygosity H declines each generation by a factor of approximately (1 − 1/(2Ne)). Starting from H₀, after t generations the expected heterozygosity is roughly H₀(1 − 1/(2Ne))^t, which for moderate t is approximately H₀ e^(−t/(2Ne)).

This matters because the Hardy–Weinberg expectation 2pq is the maximum heterozygosity for a given allele frequency under random mating. Drift does not by itself produce a deficit of heterozygotes relative to 2pq at a given p—random mating still yields Hardy–Weinberg proportions conditional on p. But drift drives p toward 0 or 1, and as p approaches fixation, 2pq approaches zero. So the population-level heterozygosity falls not because the mating system changed but because allele frequencies wandered to the boundaries where heterozygosity is necessarily low. This distinction—deficit relative to p², 2pq, q² versus loss of heterozygosity because p changed—is a common source of error in interpreting Hardy–Weinberg tests.

Distinguishing drift from the other Hardy–Weinberg violations

Drift is often taught alongside selection, mutation, migration, and nonrandom mating as one of the "forces" that violate Hardy–Weinberg. They differ in character:

Selection changes allele frequencies deterministically, in the direction of higher fitness (for constant fitnesses). Mutation introduces new alleles and changes frequencies slowly, typically at rates of 10⁻⁶ to 10⁻⁴ per generation. Migration homogenizes allele frequencies between populations. Nonrandom mating (for example, inbreeding or assortative mating) changes genotype frequencies, typically increasing homozygosity, without necessarily changing allele frequencies. Drift changes allele frequencies randomly, with direction determined by sampling, and its magnitude scales inversely with population size.

A useful diagnostic: nonrandom mating alone produces genotype frequencies that depart from Hardy–Weinberg proportions while allele frequencies stay put; drift alone changes allele frequencies while genotype frequencies can remain near Hardy–Weinberg proportions at each generation. Selection and migration can change both.

Effective population size and the practical threshold

The relevant quantity for drift is not the census population size but the effective population size, Ne, which accounts for unequal sex ratios, variance in reproductive success, population fluctuations, and other factors that reduce the number of individuals actually contributing genes to the next generation. Ne is often substantially smaller than the census count—sometimes by an order of magnitude or more in species with skewed reproductive success.

A rough rule of thumb in conservation genetics is that Ne below about 50–100 raises immediate concerns about inbreeding depression and loss of genetic variation, and Ne in the hundreds to low thousands is needed to retain evolutionary potential over long periods. These thresholds are guidelines, not sharp boundaries, and they depend on the species, the trait, and the time horizon. The point relevant here is that drift is not an exotic edge case: it operates in every finite population, and it becomes the dominant evolutionary force when Ne is small.

What the question leaves open

The phrase "can genetic drift occur in Hardy–Weinberg" does not specify a population, a locus, a species, or a time scale. The general answer—drift occurs in finite populations, which are the only kind that exist, and Hardy–Weinberg's infinite-population assumption is what rules it out—holds across contexts. But specific claims about the rate of drift, the expected time to fixation, or the magnitude of heterozygosity loss require Ne, the initial allele frequency, and the number of generations. Those values are not supplied, so no numerical prediction can be made here.

It is also worth noting that "Hardy–Weinberg equilibrium" is sometimes used loosely in applied fields (forensics, clinical genetics, quality control for genotyping) to mean "genotype frequencies consistent with Hardy–Weinberg proportions according to a statistical test." In that usage, a locus can pass a Hardy–Weinberg test in a finite population even while drifting, because the test has limited power to detect small frequency changes, and because a single generation's genotype counts can look Hardy–Weinberg-like even when p is changing. Passing a Hardy–Weinberg test is not evidence that drift is absent; it is evidence that the genotype frequencies are not grossly inconsistent with random mating at the current allele frequency.

A compact way to hold the distinction

Hardy–Weinberg describes what genotype frequencies should look like given an allele frequency and random mating. Genetic drift describes how the allele frequency itself changes in finite populations. These are answers to different questions. A finite population can satisfy the first approximately at any moment while the second is operating continuously. What cannot happen is drift under the full Hardy–Weinberg assumptions, because the infinite-population assumption sets the sampling variance to zero. So the precise answer is: drift can and does occur in real populations that are approximately in Hardy–Weinberg proportions, but it is excluded by the Hardy–Weinberg conditions themselves—and that exclusion is exactly why Hardy–Weinberg is described as an idealized null model rather than a description of any actual population.