Hi,
Welcome to ehealthforum,
Sperms can stay alive in wet environment for hours, and in warm and moist environment for 24-48 hours, and inside the vagina for upto 3-4 days. For further details consider discussing with your doctor/gynecologist.
Take care.