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

TrimesterWeeks First1-12 Second13-26 Third27-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%

Frequently Asked Questions

How is a due date calculated?

A due date is estimated as 280 days (40 weeks) from the first day of your last menstrual period (LMP). Only about 5% of babies arrive on their exact due date.

What are the trimesters?

The first trimester is weeks 1-12, the second trimester is weeks 13-26, and the third trimester is weeks 27-40.

Learn More

Guide

Pregnancy Due Date Guide: How Your Due Date Is Calculated

Learn how pregnancy due dates are calculated using Naegele's rule, ultrasound dating, and conception date methods. Understand what your estimated due date really means.

Ready to run the numbers?

Open Pregnancy Due Date Calculator