Science & history · Method
How the Sun pages calculate
Every sunrise, twilight and darkest window on these pages is worked out in your browser, by the same code, for the place and date you choose. Here is what it does and how well it agrees with independent sources.
What is calculated
The Sun's position comes from the same low-precision solar theory the rest of the site already uses for the Moon's phases (Meeus, Astronomical Algorithms, chapter 25), with a short nutation series and apparent sidereal time. Equinoxes and solstices use Meeus's chapter 27 tables. The Moon's rise and set use the site's existing lunar theory (chapter 47).
Twilight boundaries are the geometric altitude of the Sun's centre at −6°, −12° and −18°, with no refraction, as USNO defines them. Sunrise and sunset are the upper limb on a level horizon with 34′ of refraction: the centre at −0.8333°. If you give a height above the surrounding ground, the horizon is lowered by its dip, 1.76′ times the square root of the height in metres; that moves sunrise and sunset, never twilight. Elevation above sea level is recorded but not used: the horizon you see depends on the ground around you, not on the sea.
How events are found
The Sun's altitude is sampled every five minutes across the window. Every high and low point is refined, so the curve is cut into pieces where it only rises or only falls, and each crossing is then narrowed to a tenth of a second. A threshold the Sun only grazes is found from its refined extreme rather than lost between samples. The stages are read from the altitude between consecutive events, so they always fill the window exactly, with no gaps and no overlaps, and the stage at an event's moment is the one the Sun is moving into.
A day runs from local midnight to the next local midnight in the place's own time zone, so it is 23 or 25 hours long on a clock-change day. A night runs from local noon to noon, so an evening stays with the morning after it.
How well it agrees
The tests compare the engine with two outside sources, never with itself. Against Skyfield and JPL's DE421 ephemeris, every sunrise, sunset and twilight crossing in 26 reference days, from Salt Lake City to 85° north and from Kathmandu to the Chatham Islands, comes in the same order and within 30 seconds where the Sun crosses at an ordinary slant. Where it only just reaches a level (the 12-minute astronomical night at 48.55° N at midsummer, the Sun dipping to −0.86° at Tromsø in May) the times are within 90 seconds and the Sun's lowest point within 0.005°. Against the US Naval Observatory, which publishes to the minute, sunrise, sunset, civil twilight and transit are within 60 seconds on 14 reference days, and equinoxes and solstices within two minutes in seven sample years from 1900 to 2050. Moonrise and moonset are within 60 seconds of Skyfield and 90 seconds of USNO.
Those are differences between calculations. They are not promises about what you will see: USNO itself warns that real rise and set times may be in error by a minute or more because of the air on the day, and by much more at high latitudes.
Dates, places and clocks
Dates from 1900 to 2050 are accepted; the planets elsewhere on the site are only computed for that range, and the independent checks cover it. Times are shown in the place's own zone using your browser's time zone database; future clock times assume today's rules, which governments can change. Wherever a clock reading happens twice, as when clocks go back, the time carries its zone abbreviation.
Nothing about your place leaves your browser. A place you choose is kept in this browser's storage so the page remembers it; the privacy page lists what is kept, and Delete everything in Settings removes it.
Sources
- US Naval Observatory Rise, Set, and Twilight Definitions (opens in a new tab) for sunrise/sunset and the three twilights; refraction and accuracy caveats · checked 2 October 2026
- Brandon Rhodes Skyfield 1.55 with JPL DE421 (opens in a new tab) for independent twilight, transit, extreme and Moon references for the engine's tests (tools/sun-references.py)
- US Naval Observatory Astronomical Applications API (opens in a new tab) for independent sunrise, sunset, civil twilight, transit and seasons for the engine's tests · checked 2 October 2026