Summary It is widely known that bootstrap failure can often be remedied by using a technique known as the ‘m out of n’ bootstrap, by which a smaller number, m say, of observations are resampled from the original sample of size n. In successful cases of the bootstrap, the m out of n bootstrap is often deemed unnecessary. We show that the problem of constructing nonparametric confidence intervals is an exceptional case. By considering a new class of m out of n bootstrap confidence limits, we develop a computationally efficient approach based on the double bootstrap to construct the optimal m out of n bootstrap intervals. We show that the optimal intervals have a coverage accuracy which is comparable with that of the classical double-bootstrap intervals, and we conduct a simulation study to examine their performance. The results are in general very encouraging. Alternative approaches which yield even higher order accuracy are also discussed.