Abstract Study question How does viscosity influence the flagellar beating behaviour of free-swimming bull, mouse, and human sperm? Summary answer Sperm flagellar beating behaviour exhibits a transition from an irregular three-dimensional (3D) beating at 5 mPa·s to an organized two-dimensional (2D) waveform at 20 mPa·s. What is known already Sperm migrate in a complex viscoelastic environment through the female reproductive tract. The viscoelastic properties of the oviductal fluid significantly influence the progressive motility of sperm, acting as one of the key guidance mechanisms in vivo. However, the biomechanics of sperm flagellar activity in response to varying viscosity of the oviductal fluid is poorly understood. Understanding sperm flagellar behaviour in physiologically relevant environments is crucial to understanding reproduction and may help to describe unknown causes of infertility. Lack of high-speed high-resolution imaging techniques and automated image-analysis capabilities have been the main barriers to fully describe the flagellar beating behaviour. Study design, size, duration We used a custom-built high-speed high-resolution dark-field microscopy platform to resolve the flagellar dynamics of human, bull, and mouse sperm near surfaces in viscoelastic media ranging in viscosity from 1 to 250 mPa·s. The imaging system includes an automated image analysis algorithm to quantify sperm flagellar waveform and motility characteristics by extracting the flagellar centreline, reconstructing the waveform and calculating tangent-angle profiles. 20 sperm from 3 different bull, mice and humans were analyzed. Participants/materials, setting, methods Bull, mouse, and human sperm were used in this study. In each experiment, a diluted sperm sample in a buffer supplemented with methylcellulose was used and free-swimming sperm were imaged using dark-field microscopy at 200 frames per second. An automated image analysis algorithm was used to extract sperm flagellar centreline and Proper Orthogonal Decomposition (POD) was then used to study sperm flagellar waveform. Statistical analysis was performed using one-way ANOVA. Main results and the role of chance The reconstructed flagellar beating pattern was different for sperm swimming in low and high-viscosity media. Bull sperm exhibited a lower flagellar beating amplitude along the end piece when swimming in a high-viscosity media, a potential energy-efficient strategy to navigate a high viscosity fluid. The first two dominant POD modes (shape modes) describe more than 90% of the beating pattern for all species. Bull sperm exhibited a transition mode with irregular loops in 5 mPa·s buffer, but the flagellar shape cycle created an organised repetitive circular cycle in 1 mPa.s (3D beating) buffer and at viscosities higher than 5 mPa·s (2D beating). Human sperm also indicated a similar behaviour but with the transition happening at higher viscosities. Mouse sperm in high-viscosity media had a lower flagellar beating amplitude across the principal piece and higher beating amplitude across the end piece. The flagellar shape cycle in mouse sperm showed a periodic flagellar beating behaviour at high-viscosities (>20 mPa·s), but a shape cycle with distorted loops at lower viscosities. Our results showed in quantitative detail that increasing viscosity alters sperm flagellar beating pattern, and how sperm migration behaviour in low viscosity media can be distinct from their swimming behaviour in vivo. Limitations, reasons for caution A more comprehensive study of sperm motility parameters such as curvilinear velocity, average path velocity and straight line velocity with a larger sample size is required to fully characterise sperm swimming behaviour as a function of viscosity. Wider implications of the findings The increasing viscosity of the oviductal fluid regulates the sperm flagellar beating behaviour to switch from a 3D swimming behaviour with irregular shape cycles at lower viscosities to a 2D slithering mode with repetitive circular shape cycles at higher viscosities to achieve a more energy-efficient beating pattern for navigation. Trial registration number Not applicable