Heart wall myofibers wind as helices around the ventricles, strengthening them in a manner analogous to the reinforcement of concrete cylindrical columns by spiral steel cables. A multitude of such fibers, arranged smoothly and regularly, contract and relax as an integrated functional unit as the heart beats. To orchestrate this, fiber tangling must be avoided while pumping should be efficient. Current models of myofiber orientation across the heart wall suggest groupings into sheets or bands, but the precise geometry of bundles of myofibers is unknown. Here we show that this arrangement takes the form of a special minimal surface, the generalized helicoid, closing the gap between individual myofibers and their collective wall structure. The model holds across species, with a smooth variation in its three curvature parameters within the myocardial wall providing tight fits to diffusion magnetic resonance images from the rat, the dog and the human. Mathematically it explains how myofibers are bundled in the heart wall while economizing fiber length and optimizing ventricular ejection volume as they contract. The generalized helicoid provides a novel foundation for analyzing the fibrous composite of the heart wall and should therefore find applications in heart tissue engineering and in the study of heart muscle diseases.