Calculate Gestational Age

Gestational Age Calculator

Calculate exactly how far along you are in your pregnancy and your estimated due date based on your last period.

Default is 28 days.

How Gestational Age is Calculated

Gestational age is the measure of how far along a pregnancy is. It is measured in weeks, starting from the first day of your last menstrual period (LMP). Because the exact date of conception is often unknown, healthcare providers use the LMP as the starting point for a 40-week (280-day) pregnancy.

The Formula Behind the Calculation

This calculator utilizes two primary formulas to provide your pregnancy timeline:

  • Current Gestational Age: This is calculated by finding the total number of days between Today's Date and your LMP, then dividing by 7.
  • Naegele's Rule (Due Date): The standard formula is: LMP + 7 Days – 3 Months + 1 Year. Our calculator further adjusts this based on your specific cycle length to increase accuracy.

Pregnancy Milestones Example

Stage Timeline
First Trimester Week 1 – Week 12
Second Trimester Week 13 – Week 26
Third Trimester Week 27 – Birth

Frequently Asked Questions

What if I have an irregular cycle? If your cycle is shorter or longer than the average 28 days, your ovulation date shifts. This calculator allows you to adjust the "Cycle Length" to better estimate your due date.

Can I use an ultrasound date instead? While LMP is the standard for initial dating, an early ultrasound (performed between weeks 8-12) is considered the most accurate way to confirm gestational age. If your ultrasound date differs significantly from your LMP date, your provider will likely use the ultrasound date.

function calculateGestationalAge() { var lmpInput = document.getElementById('lmpDate').value; var cycleLength = parseInt(document.getElementById('cycleLength').value); var resultDiv = document.getElementById('gestationalResult'); if (!lmpInput) { alert('Please select a valid date for your Last Menstrual Period.'); return; } var lmpDate = new Date(lmpInput); var today = new Date(); // Reset hours to midnight for accurate day calculation lmpDate.setHours(0, 0, 0, 0); today.setHours(0, 0, 0, 0); if (lmpDate > today) { alert('LMP date cannot be in the future.'); return; } // Time difference in milliseconds var diffTime = today.getTime() – lmpDate.getTime(); var diffDays = Math.floor(diffTime / (1000 * 60 * 60 * 24)); // Adjust for cycle length (Standard is 28 days) // If cycle is 30, it adds 2 days to the total duration var cycleAdjustment = cycleLength – 28; var weeks = Math.floor(diffDays / 7); var days = diffDays % 7; // Calculate Estimated Due Date (280 days is standard) var dueDate = new Date(lmpDate); dueDate.setDate(dueDate.getDate() + 280 + cycleAdjustment); // Determine Trimester var trimester = ""; if (weeks < 13) { trimester = "First Trimester"; } else if (weeks < 27) { trimester = "Second Trimester"; } else { trimester = "Third Trimester"; } // Countdown to due date var countdownTime = dueDate.getTime() – today.getTime(); var countdownDays = Math.ceil(countdownTime / (1000 * 60 * 60 * 24)); // Display Results document.getElementById('currentAgeResult').innerHTML = "You are " + weeks + " weeks and " + days + " days pregnant."; document.getElementById('dueDateResult').innerHTML = "Estimated Due Date: " + dueDate.toLocaleDateString(undefined, { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }); document.getElementById('trimesterResult').innerHTML = "Current Stage: " + trimester + ""; if (countdownDays > 0) { document.getElementById('countdownResult').innerHTML = "Only " + countdownDays + " days remaining until your due date!"; } else if (countdownDays === 0) { document.getElementById('countdownResult').innerHTML = "Today is your Estimated Due Date!"; } else { document.getElementById('countdownResult').innerHTML = "You are past your estimated due date."; } resultDiv.style.display = 'block'; // Smooth scroll to result resultDiv.scrollIntoView({ behavior: 'smooth', block: 'nearest' }); }

Leave a Comment