Pregnancy Due Date Calculator Formula

Understand the math behind the pregnancy due date calculator. Each variable explained with a worked example.

Formulas Used

Weeks Remaining

weeks_remaining = floor(days_remaining / 7)

Days Remaining

days_remain = days_remaining

Current Trimester

trimester = weeks_pregnant < 13 ? 1 : (weeks_pregnant < 27 ? 2 : 3)

Pregnancy Progress

progress_pct = total_days_pregnant / 280 * 100

Variables

VariableDescriptionDefault
weeks_pregnantWeeks Pregnant(weeks)12
days_extraExtra Days(days)0
total_days_pregnantDerived value= weeks_pregnant * 7 + days_extracalculated
days_remainingDerived value= 280 - total_days_pregnantcalculated

How It Works

Pregnancy Duration

A typical pregnancy lasts 40 weeks (280 days) from the first day of the last menstrual period (LMP).

Trimesters

| Trimester | Weeks | |---|---| | First | 1-12 | | Second | 13-26 | | Third | 27-40 |

Worked Example

A woman who is 12 weeks and 0 days pregnant.

weeks_pregnant = 12days_extra = 0
  1. 01Total days pregnant = 12 x 7 + 0 = 84 days
  2. 02Days remaining = 280 - 84 = 196 days
  3. 03Weeks remaining = floor(196 / 7) = 28 weeks
  4. 04Progress = 84 / 280 x 100 = 30.0%

Ready to run the numbers?

Open Pregnancy Due Date Calculator