The number of days before and after your period that are safe for sexual activity depends on the length of your menstrual cycle and the timing of ovulation. Generally, the fertile window (when pregnancy is most likely to occur) is 5 days before ovulation until the day of ovulation. It's important to use contraception if you're not trying to conceive, as sperm can live in the body for up to 5 days.