This paper introduces optimal design of randomized experiments where individuals are nested within organizations, such as schools, health centers, or companies. The focus is on nested designs with two levels (organization, individual) and two treatment conditions (treated, control), with treatment assignment to organizations, or to individuals within organizations. For each type of assignment, a multilevel model is first presented for the analysis of a quantitative dependent variable or outcome. Simple equations are then given for the optimal sample size per level (number of organizations, number of individuals) as a function of the sampling cost and outcome variance at each level, with realistic examples. Next, it is explained how the equations can be applied if the dependent variable is dichotomous, or if there are covariates in the model, or if the effects of two treatment factors are studied in a factorial nested design, or if the dependent variable is repeatedly measured. Designs with three levels of nesting and the optimal number of repeated measures are briefly discussed, and the paper ends with a short discussion of robust design.