N-of-1 trials, single participant trials in which multiple treatments are sequentially randomized over the study period, can give direct estimates of individual-specific treatment effects. Combining n-of-1 trials gives extra information for estimating the population average treatment effect compared with randomized controlled trials and increases precision for individual-specific treatment effect estimates. In this paper, we present a procedure for designing n-of-1 trials. We formally define the design components for determining the sample size of a series of n-of-1 trials, present models for analyzing these trials and use them to derive the sample size formula for estimating the population average treatment effect and the standard error of the individual-specific treatment effect estimates. We recommend first finding the possible designs that will satisfy the power requirement for estimating the population average treatment effect and then, if of interest, finalizing the design to also satisfy the standard error requirements for the individual-specific treatment effect estimates. The procedure is implemented and illustrated in the paper and through a Shiny app.