This paper presents a general algorithm for constructing strata in a population using "X", a univariate stratification variable known for all the units in the population. Stratum "h" consists of all the units with an "X" value in the interval ["b" "h" - 1 , "b h") . The stratum boundaries {"b h"} are obtained by minimizing the anticipated sample size for estimating the population total of a survey variable "Y" with a given level of precision. The stratification criterion allows the presence of a take-none and of a take-all stratum. The sample is allocated to the strata using a general rule that features proportional allocation, Neyman allocation, and power allocation as special cases. The optimization can take into account a stratum-specific anticipated non-response and a model for the relationship between the stratification variable "X" and the survey variable "Y". A loglinear model with stratum-specific mortality for "Y" given "X" is presented in detail. Two numerical algorithms for determining the optimal stratum boundaries, attributable to Sethi and Kozak, are compared in a numerical study. Several examples illustrate the stratified designs that can be constructed with the proposed methodology. All the calculations presented in this paper were carried out with stratification , an R package that will be available on CRAN (Comprehensive R Archive Network). Copyright (c) 2009 The Authors. Journal compilation (c) 2009 International Statistical Institute.