Menstrual Cycle Length Tracker Formula

Understand the math behind the menstrual cycle length tracker. Each variable explained with a worked example.

Formulas Used

Days Until Next Period

next_period_in = max(cycle_length - days_since_period, 0)

Current Cycle Day

current_phase = days_since_period

Ovulation Expected on Day

ovulation_day_display = ovulation_day

PMS Window Starts Day

pms_starts_day = cycle_length - 7

Variables

VariableDescriptionDefault
cycle_lengthAverage Cycle Length(days)28
period_lengthPeriod Duration(days)5
days_since_periodDays Since Last Period Started(days)15
ovulation_dayDerived value= cycle_length - 14calculated

How It Works

Menstrual Cycle Phases

Typical 28-Day Cycle

| Phase | Days | Description | |---|---|---| | Menstruation | 1-5 | Period bleeding | | Follicular | 1-13 | Follicle development | | Ovulation | ~14 | Egg release | | Luteal | 15-28 | Post-ovulation | | PMS Window | ~21-28 | Premenstrual symptoms |

Next Period = Cycle Length - Days Since Last Period Ovulation Day = Cycle Length - 14

Worked Example

A 28-day cycle, period lasts 5 days, currently on day 15.

cycle_length = 28period_length = 5days_since_period = 15
  1. 01Next period in = 28 - 15 = 13 days
  2. 02Ovulation day = 28 - 14 = Day 14 (just passed)
  3. 03PMS window starts = Day 21 (in 6 days)

Ready to run the numbers?

Open Menstrual Cycle Length Tracker