Moon Phase Calculator Formula

Understand the math behind the moon phase calculator. Each variable explained with a worked example.

Formulas Used

Phase (0-1 cycle)

phase_fraction = days_since_new / 29.53

Illumination (%)

illumination = (1 - cos(2 * pi * days_since_new / 29.53)) / 2 * 100

Variables

VariableDescriptionDefault
days_since_newDays Since New Moon(days)7.38

How It Works

Moon Phase Estimation

The synodic month (new moon to new moon) averages 29.53 days.

Illumination Formula

Illumination = (1 - cos(2π × d / 29.53)) / 2

where d = days since last new moon. This gives 0% at new moon, 50% at first/third quarter, and 100% at full moon.

Phase names: 0-1.85 days = New, 1.85-7.38 = Waxing Crescent, 7.38 = First Quarter, 7.38-14.76 = Waxing Gibbous, 14.76 = Full, etc.

Worked Example

7.38 days after new moon (first quarter).

days_since_new = 7.38
  1. 01Phase = 7.38 / 29.53 = 0.250 (25% of cycle)
  2. 02Illumination = (1 - cos(2π × 0.250)) / 2
  3. 03= (1 - cos(π/2)) / 2 = (1 - 0) / 2 = 50%
  4. 04First quarter: half the disc is lit.

Frequently Asked Questions

How do I find when the last new moon was?

Astronomical almanacs and many websites list new moon dates. A recent reference: 2024-01-11 was a new moon. Count days forward from any known new moon.

Why is the cycle 29.53 days, not the orbital period?

The Moon's orbital (sidereal) period is 27.32 days, but the synodic month is longer because Earth also moves around the Sun, so the Moon needs extra time to return to the same Sun-Moon-Earth alignment.

Does this account for libration?

No. This is a simple geometric illumination model. Actual illumination can vary slightly due to the Moon's orbital eccentricity and inclination.

Ready to run the numbers?

Open Moon Phase Calculator