The depth of the active root zone identifies the portion of the subsurface that exchanges soil water with the atmosphere. The depth of this zone is determined by a number of factors, and this work focuses on the drivers related to water and climate. An analytical expression for a water-optimal root depth is developed by equating the marginal carbon cost and benefit of deeper roots. Soil-moisture dynamics are driven by stochastic rainfall, and the predicted root depth is a function climate, soil, and vegetation characteristics. Consistent with results from the field, deep roots coincide with environments for which precipitation and potential evapotranspiration are approximately equal. For water-limited ecosystems, increases in the wetness of the climate produce deeper roots, and root depth is more sensitive to changes in the depth of rain events than to their frequency. In wet environments, the opposite is true; root depth generally decreases with increasing wetness and shows greater sensitivity to changes in rainfall frequency than intensity.