We know that ovulation, when an egg is released from your ovary, typically occurs at the halfway point of your cycle, according to the the American College on Obstetrics and Gynecology (ACOG). Meaning, if the first day of your period was day 1 of your cycle, then ovulation would occur somewhere between day 11 and 21. (If you're not already tracking your period, one easy way to estimate when you ovulated would be to count back 12–16 days from your next expected period.)
It can be pretty difficult to determine exactly when you're ovulating each month, so technically your "fertile window," the time when you could get pregnant, spans about four to five days before ovulation, the day of ovulation, and maybe the day after, Kate O'Connell White, MD, MPH, Ob/Gyn at Boston University, Boston Medical Center told Refinery29. Once an egg is released, it can only live for 12 to 24 hours, while sperm can live in the vagina for two to five days, according to the ACOG.
After your fertile window, assuming the egg didn't get fertilized, your body gets ready to shed its endometrial lining and pass the egg. If you have a regular 28-day cycle and have been doing the math, then the days after the fertile window, but right before your period, would actually be a relatively safe time to have sex and avoid pregnancy, according to the American Pregnancy Association. In a nutshell, if you're not trying to get pregnant, your goal is to basically try to have sex as far away from ovulation as possible.
But the problem is most people's cycles are not always regular. Depending on the length of your period or the exact time that you ovulated, your fertile window can shift a few days. In other words, yes, that means that you could theoretically get pregnant if you ovulated later or started your period sooner than average. So, the bottom line if you are trying to make sense of your calendar and cycle: It's always smart to use a backup birth control method if you're having sex and not trying to get pregnant.