Minecraft has an auto-sprint feature that allows your character to start running without having to hold down a key.
Activating auto-sprint will make it easier for you to cover long distances and move around the world.
Activating sprint toggle mode
Pause the game. Select “Settings” and open Accessibility Settings.
Find the “Run” option and switch it from ‘Hold’ to “Toggle”.
After changing the setting, click “Done” to save the changes.
Checking and using the sprint key
Next, go to the “Controls” section, then to the “Key Assignments” subsection.

This list displays all current key combinations, including the one responsible for sprinting. By default, this is the left Ctrl key, but it can be changed manually.
Here you can see which key activates sprint in the current control configuration.
Knowing the right key to activate, you can easily activate auto-sprint at the right moment.
Auto-sprint is disabled by pressing the key again.