1D mesoporous materials have attracted extensive interest recently, owning to their fascinating properties and versatile applications. However, it remains as a grand challenge to develop a simple and efficient technique to produce oxide nanofibers with mesoporous architectures, controlled morphologies, large surface areas, and optimal performances. In this work, a facile foaming-assisted electrospinning strategy with foaming agent of tea saponin is used to produce thoroughly mesoporous ZnO nanofibers with high purity and controlled morphology. Interestingly, mesoporous fibers with elliptical cross-section exhibit the significantly enhanced photocatalytic activity for hydrogen production, as compared to the counterparts with circular and rectangular cross-sections, and they also perform better than the commercial ZnO nanopowders. The unexpected shape dependence of photocatalytic activities is attributed to the different stacking modes of the mesoporous fibers, and a geometrical model is developed to account for the shape dependence. This work represents an important step toward producing thoroughly mesoporous ZnO nanofibers with tailored morphologies, and the discovery that fibers with elliptical cross-section render the best performance provides a valuable guideline for improving the photocatalytic performance of such mesoporous nanomaterials. © 2016 WILEY-VCH Verlag GmbH & Co. KGaA, Weinheim.