Stratified randomization splits users into groups on a known characteristic and randomizes separately within each. Both arms then contain the same mix by construction, removing a source of imbalance rather than adjusting for it after the fact.
Design experiments inside Claude with Bell's MCP serverIt runs the Bell Statistics engine as tools your assistant can call — geo test design and measurement today, A/B testing next.
Plain randomization balances user characteristics in expectation, but not necessarily on any particular run. If the randomization mechanism works properly, there is no systematic reason for one group to contain different types of users than another. By chance, however, the groups may still differ on some characteristics in a given experiment. If those differences are substantial, they can introduce imbalance between the groups and make it harder to determine whether an observed effect is caused by the treatment or by differences in who ended up in each group.
Stratified randomization is useful when you do not want to leave important characteristics entirely to chance. Instead, you explicitly control the assignment of users to ensure balance on selected parameters. The method is simple: divide users into strata — for example, mobile and desktop users, or users from different countries — and perform a separate balanced randomization within each stratum. This ensures that both experiment arms contain the same proportion of users from each stratum, by construction. Because you need to know each user's characteristics before assignment, stratification is mainly relevant for tests on existing users, whose characteristics are already known.
The benefit comes in two ways. First, balance on the stratifying variable is guaranteed rather than merely expected, eliminating a source of chance imbalance that plain randomization can only make unlikely. Second, when the stratifying variable predicts the outcome, stratification can reduce variance because between-stratum differences no longer contribute as much noise to the treatment comparison. The intuition is similar to that behind a paired t-test: by comparing like with like, you remove some of the variation that would otherwise obscure the treatment effect. Here, the matching happens at the group level rather than between individual observations.
The formula
The algorithm is straightforward. First, divide users into strata based on the characteristic you want to balance — for example, mobile and desktop users, or new and returning users. Then, within each stratum, block users into small groups and assign users within each block according to a pre-specified order (e.g., ABBA) so that the desired proportion goes to each arm. Finally, combine the assignments across all strata. Because the randomization is balanced within every stratum, the treatment and control groups contain the same proportion of users from each stratum, rather than relying on this balance to occur by chance.
Stratified randomization on device, in two colors. 1. Users are divided into two strata, mobile and desktop. 2. Within each stratum they are assigned in small blocks, each with an equal number of A (control) and B (treatment) labels in random order: ABBA, BA, BAAB. 3. Combining the strata gives two arms with exactly the same mix: three mobile and two desktop users in each.
Variance decomposition
Vartotal = Varwithin strata + Varbetween strata
The statistical benefit comes from the way stratification partitions the outcome variance. When the stratifying variable predicts the outcome, users in different strata tend to have different average outcomes. Stratification ensures that these between-stratum differences are represented equally in both arms, so they contribute less noise to the treatment comparison.
The reduction
Varstratified ≈ Vartotal · (1 − η²)
Here, η² is the proportion of outcome variance explained by the stratifying variable. The more predictive the stratifying variable is, the greater the potential variance reduction. This is the same intuition behind the familiar (1 − ρ²) variance reduction in CUPED: explaining more of the outcome variation leaves less unexplained variation in the treatment comparison.
Expected imbalance under plain randomization
SD(arm difference) ≈ √[2p(1 − p)n]
To understand the benefit of stratified randomization, it helps to know how large the imbalance on a characteristic would typically be under plain randomization. This formula gives the typical size of that random imbalance: the standard deviation of the difference between the arms in the share of users with the characteristic. It shrinks as the number of users grows, which is why stratification matters most in small experiments.
p is the overall proportion of users with the characteristic.
n is the number of users per arm.
A note on analysis
Y = β0 + β1·treated + β2·stratum
You do not necessarily need to stratify the randomization to obtain some of the same variance reduction. If the stratifying variable is predictive of the outcome, you can instead include it as an explanatory variable in the analysis. Regression adjustment accounts for differences between strata when estimating the treatment effect, while leaving the original random assignment unchanged. In other words, stratification improves balance before the experiment, whereas regression adjustment controls for the same source of variation during analysis. The two also work together: if you stratify the assignment, include the stratum in the analysis as well, because a plain comparison of means ignores the balance you built in and overstates the standard error.
Worked example
Suppose 50% of your users are on mobile and 50% are on desktop. If you randomly assign 4,000 users to treatment and 4,000 to control, you would expect both groups to be about 50% mobile. But randomization does not guarantee exactly 50% in each group. You might, for example, end up with 2,032 mobile users in treatment (50.8%) and 1,968 in control (49.2%). The two groups therefore differ by 1.6 percentage points.
Share of users on mobile (p)
50%
Users per arm (n)
4,000
Mobile users in treatment
2,032 (50.8%)
Mobile users in control
1,968 (49.2%)
Plain randomization leaves a typical imbalance of 1.1 percentage points at 4,000 users per arm and 0.07 at 1,000,000; stratifying on device keeps it within one user, 0.025 points
The difference in mobile share between the arms over 40 simulated random assignments; each dot is one assignment. The shaded band is ±1 standard deviation of that difference under plain randomization, 1.1 points at 4,000 users per arm: about two-thirds of assignments land inside it, so the example's 1.6 is an ordinary draw. With 1,000,000 per arm the spread shrinks to about ±0.07 points. Stratified on device, the arms can differ by at most one user per stratum, when a stratum has an odd number of users — 0.025 points here, so the dots sit on zero.
This difference is not a problem with the randomization — it is simply the result of chance. If you repeated the random assignment many times, the difference would vary from one experiment to another, sometimes being close to zero and sometimes larger, and 1.6 points is an unremarkable draw at this sample size. The key point is that random imbalance shrinks as the number of users grows. Stratification removes this particular source of imbalance altogether, so its practical value is greatest when the experiment is small or when the characteristic being stratified on is especially important.
Common misconceptions
דStratified randomization is more random than plain randomization.”
It is more constrained. Assignment is still random within each stratum, but the overall allocation is restricted to those that balance the strata. That restriction is the point — it removes outcomes that plain randomization would have permitted and you would not have wanted, at the cost of a slightly more complex assignment layer.
דYou should stratify on every variable you have.”
Each stratifying variable multiplies the number of strata, and with too many you end up with cells containing a handful of users, where balance becomes impossible and the whole exercise adds complexity for nothing. Pick the one or two variables that most strongly predict the outcome, and handle the rest at analysis if needed.
דStratification fixes imbalance in variables you did not stratify on.”
It guarantees balance only on the variables used, and leaves everything else to chance exactly as before. That is the fundamental limit compared with what randomization gives you in expectation across all variables, including unmeasured ones. Stratification strengthens a few specific guarantees; it does not create new ones.
Frequently asked questions
When is stratified randomization worth the complexity?
When the sample is small enough for imbalance to be plausible — roughly below ten thousand units — or when one stratum is both small and very different from the rest, such as enterprise accounts among mostly small ones. It is also standard in geo experiments, where a few dozen markets make imbalance very likely. Above a million users per arm, chance imbalance is negligible, and adjusting for the stratum at analysis gets the same variance reduction without changing the assignment.
Is it better to stratify at assignment or adjust at analysis?
Adjusting at analysis captures most of the variance reduction, needs no change to the assignment system, and can be applied retrospectively — for large experiments it is usually the better trade. Stratifying at assignment additionally guarantees balance, which is what you want when the sample is small enough that a bad split is a real possibility rather than a theoretical one.
Is blocking the same as stratification?
In practice yes, and the words are used interchangeably in experimentation. Blocking is the older term from agricultural and clinical trial design, where units are grouped into blocks of similar characteristics before assignment; stratification is more common in survey and online experiment contexts. Both mean grouping units on a known variable and randomizing within groups. Any distinction is disciplinary rather than substantive.
Applying it to a live measurement problem is the part that goes wrong. If you are designing an experiment, reading a result you do not trust, or trying to work out what your marketing actually caused, that is the work we do.
References
Fisher, R. A. (1935). The Design of Experiments. Oliver and Boyd.
Imbens, G. W., & Rubin, D. B. (2015). Causal Inference for Statistics, Social, and Biomedical Sciences. Cambridge University Press.