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.

Ready to run the numbers?

Open Moon Phase Calculator