Depending on the conditions outside the body, sperm can live from a few minutes to 20 minutes approximately. However, factors such as smoking, air pollution, alcohol, anabolic steroids, STDs, etc. could contribute to lessening this lifespan.
Check this out: What’s the Function of a Sperm Cell? – Definition & Structure.