Sperm can stay alive inside a woman's body for up to 5 days under optimal conditions. This survival time depends largely on the environment within the female reproductive tract, particularly the presence of fertile cervical mucus that protects and nourishes the sperm. Without such conditions, sperm lifespan may be shorter, often a few hours to a few days. This window allows sperm to potentially fertilize an egg if ovulation occurs within this timeframe after intercourse.