Pregnancy Due Date Calculator (Naegele) Formula

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

Formulas Used

Current Gestational Week

gestational_weeks = floor(lmp_days_ago / 7)

Extra Days

gestational_days_extra = lmp_days_ago - floor(lmp_days_ago / 7) * 7

Days Until Due Date

days_remaining = max(280 - lmp_days_ago, 0)

Weeks Remaining

weeks_remaining = max(280 - lmp_days_ago, 0) / 7

Variables

VariableDescriptionDefault
lmp_days_agoDays Since Last Period Started(days)84

How It Works

Naegele's Rule

The estimated due date is 280 days (40 weeks) from the first day of the last menstrual period (LMP).

Due Date = LMP + 280 days

Trimester Breakdown

TrimesterWeeks First1-12 Second13-27 Third28-40

Only about 5% of babies are born on their exact due date. Most arrive within 2 weeks of the estimate.

Worked Example

A woman whose last period started 84 days ago.

lmp_days_ago = 84
  1. 01Gestational week = floor(84 / 7) = 12 weeks
  2. 02Extra days = 84 - 12 x 7 = 0
  3. 03Days remaining = 280 - 84 = 196 days
  4. 04Weeks remaining = 196 / 7 = 28.0 weeks

Frequently Asked Questions

How accurate is the due date?

Naegele's rule is an estimate. About 80% of babies are born between 38 and 42 weeks. An early ultrasound can refine the estimate.

What if my cycles are not 28 days?

Naegele's rule assumes a 28-day cycle with ovulation on day 14. If your cycles are longer or shorter, the due date may shift accordingly.

When is each trimester?

First trimester: weeks 1-12. Second trimester: weeks 13-27. Third trimester: weeks 28-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.