We develop a Bayesian approach for calculating sample sizes for clinical trials under the framework of hypothesis tests. We extend the work of Weiss (The Statistician 1997; 46: 185-191) to include composite distributions for the treatment effect and the variance of the data within the null and alternative hypotheses. We select sample sizes using the Bayes factor and the averaged type I error and type II error defined by Weiss (The Statistician 1997; 46: 185-191). Our approach allows the uncertainty inherent in eliciting prior information for both the treatment effect and the variance and permits informative prior information for unknown quantities through the hypothesis specification. We illustrate our method through a real data example from a clinical trial for treatment of multiple sclerosis and from the cerclage trial for preterm birth prevention in high-risk women. © 2011 Elsevier Inc.