Inertial swimmers use flexural movements to push water and generate thrust. We quantify this dynamical process for a slender body in a fluid by accounting for passive elasticity and hydrodynamics and active muscular force generation and proprioception. Our coupled elastohydrodynamic model takes the form of a nonlinear eigenvalue problem for the swimming speed and locomotion gait. The solution of this problem shows that swimmers use quantized resonant interactions with the fluid environment to enhance speed and efficiency. Thus, a fish is like an optimized diode that converts a prescribed alternating transverse motion to forward motion. Our results also allow for a broad comparative view of swimming locomotion and provide a mechanistic basis for the empirical relation linking the swimmer's speed U, length L, and tail beat frequency f, given by U=L ∼ f [Bainbridge R (1958) J Exp Biol 35:109-133]. Furthermore, we show that a simple form of proprioceptive sensory feedback, wherein local muscle activation is function of body curvature, suffices to drive elastic instabilities associated with thrust production and leads to a spontaneous swimming gait without the need for a central pattern generator. Taken together, our results provide a simple mechanistic view of swimming consistent with natural observations and suggest ways to engineer artificial swimmers for optimal performance.inertial swimming | gait selection | proprioception U nderstanding locomotory behavior requires that we integrate the neural control of muscular dynamics with the body mechanics of the organism as it interacts with the environment. Simultaneously, we must also account for sensory feedback from the environment and from the organism's sense of its own shape. However, translating these concepts to quantitative theories is challenging because of the variety of organism sizes and shapes and the complexity of their physical and biological environment. Therefore, investigations typically focus on specific organisms and try to glean principles that might be of broader relevance. In the context of terrestrial locomotion, recent experimental and theoretical work on the undulating worm Caenorhabditis elegans (1) shows that proprioceptive feedback suffices to coordinate undulatory motions. Complementing these studies, general theoretical models have explored the conditions under which coordinated crawling occurs in a coupled brain-body-environment system (2). These models explain observations in larvae of Drosophila melanogaster, showing how a sensorimotor coupling that links brain, body, and environment can robustly lead to crawling in a range of conditions.Translating these ideas to macroscopic aquatic locomotion, when inertia dominates viscous forces, is a formidable challenge owing to the presence of complex hydrodynamic nonlinearities, which must be coupled to body mechanics and neural dynamics of proprioceptive and sensory feedback. The hydrodynamics of swimming has been the subject of a variety of studies for more than half a century from experimen...