alarm-clock.org/methodology/moon-phase

How the moon phase is calculated

Every figure on a moon page — the phase, the illuminated percentage, moonrise and moonset, the next full moon — is computed in your browser. This is the method and its limits.

Where the moon is

The moon's position comes from the periodic-term series in chapter 47 of Jean Meeus's Astronomical Algorithms, truncated to its leading terms. Four angles drive it, each a simple linear function of time: mean longitude, mean anomaly, argument of latitude, and mean elongation from the sun.

Those four feed three series — one for ecliptic longitude, one for latitude, one for distance — which are then rotated into right ascension and declination using the same axial tilt the sun calculation uses.

The distance series is deliberately kept longer than the other two. The short form everyone quotes, 385001 − 20905 cos M′, can be off by around two thousand kilometres, and distance is what decides whether a full moon is called a supermoon — so a truncation that is harmless for the phase name is not harmless there.

Phase and illumination

Elongation. The angle at your eye between the sun and the moon, from their two positions.
Phase angle. The angle at the moon between the sun and the Earth, which needs the moon's distance — this is where the distance series earns its length a second time.
Illuminated fraction. (1 + cos i) / 2, where i is that phase angle. Zero at new moon, one at full.
Waxing or waning. Decided by the sign of the position angle of the bright limb, which is also what tells the drawing on the page which side to light.

The phase name — waxing crescent, first quarter, waning gibbous — is a band of that cycle position, not a separate calculation.

The exact moment of a new or full moon

"When is the next full moon" is a different question from "how lit is it now", and it gets a different method: chapter 49 of the same book, which solves directly for the instant of a primary phase rather than searching the illumination curve for a maximum. It starts from the mean lunation — 29.530588861 days — and applies the corrections for the sun's and moon's anomalies and the moon's argument of latitude.

That is why the site can name a minute rather than a day, and why the answer does not drift as the lunation count grows.

Moonrise and moonset

There is no closed form for these, because the moon moves too fast against the stars for the "solve once for the day" trick that works for the sun. Instead the altitude is sampled every hour through the local day and the horizon crossings are interpolated with a quadratic through each set of three samples — the same approach SunCalc uses.

The horizon angle is +0.133°, not the sun's −0.833°. The moon is much closer, so parallax works against its apparent altitude rather than for it, and the net allowance for its semidiameter plus refraction lands just above the horizon instead of below.

On roughly one day in a month the moon does not rise, or does not set, within a given calendar day — because it comes up about fifty minutes later each day and eventually a rise falls off the end of the day. That is real, not a bug, and the page reports it as such.

Limits worth knowing

Truncated series. The full Meeus tables have dozens of terms; the leading ones are used here. Good to a small fraction of a degree, not to the arcsecond.
Geocentric, not topocentric. Positions are as seen from the centre of the Earth. For phase and illumination that is the right frame; for exactly where the moon sits in your sky it is a simplification.
Same horizon caveats as the sun. Elevation, terrain and non-standard refraction are not modelled here either.
Not for eclipse prediction. Eclipses need the node geometry solved properly, and this does not do it.

Related

Moon phase tonight · How sunrise and sunset are calculated · Where the tide predictions come from

💡 How do we make alarm-clock.org better? Share an idea →

Every tool here is free, needs no sign-up, and gets better because people tell us what's missing. If you have an idea, we'd love to hear it.

Every suggestion is read and reviewed. We can't promise to act on them all, but they directly shape what we build next.