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

PhaseDaysDescription Menstruation1-5Period bleeding Follicular1-13Follicle development Ovulation~14Egg release Luteal15-28Post-ovulation PMS Window~21-28Premenstrual 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)

Frequently Asked Questions

What is a normal cycle length?

Normal cycles range from 21 to 35 days. The average is 28 days. Variation of a few days between cycles is normal.

When does PMS start?

PMS symptoms typically begin 7-10 days before the period (during the late luteal phase) and resolve once menstruation starts.

What causes irregular cycles?

Stress, weight changes, exercise, hormonal conditions, birth control, and perimenopause can all cause irregular cycles. Consult a doctor if cycles are consistently outside 21-35 days.

Ready to run the numbers?

Open Menstrual Cycle Length Tracker