Method
How Sun computes the sun
Every time in Sun — sunrise, sunset, solar noon, twilight, golden hour — comes from one reference algorithm: NOAA's Solar Calculator, itself a spreadsheet form of Jean Meeus' Astronomical Algorithms. No API, no network call, no third-party service. The same equations run on your phone and, right here, in your browser.
The five numbers it needs
| Number | What it is | Why it matters |
|---|---|---|
| Julian day | A continuous count of days since 4713 BC, so the math never handles months or leap years. | Leap years and century rules need no special cases. |
| Solar declination | How far the sun sits above or below the celestial equator today. | This is the number that drives the seasons. |
| Equation of time | The gap between clock noon and solar noon, in minutes. | Reaches about 16 minutes, in both directions. |
| Hour angle | How far the sun travels from solar noon to reach a given altitude. | Produces the rise and set times — or shows there are none. |
| Atmospheric refraction | Light bends near the horizon, so the sun is visible slightly before it geometrically rises. | Worth about two minutes at each end of the day. |
Where each line is drawn
Each event is the moment the sun crosses a fixed angle from straight overhead. Sunrise is past 90° because of refraction.
| Event | Angle from overhead |
|---|---|
| Sunrise and sunset | 90.833° |
| 96° | |
| Nautical twilight | 102° |
| Astronomical twilight | 108° |
Try it — any place, any day
Results
The working
These are the same four intermediate values NOAA's own calculator prints, so this page can be checked against theirs line by line.
Why compute it, not fetch it
A lookup API is a service that can rate-limit you, go down, or start charging — for a quantity that is genuinely just arithmetic. Sun computes everything the way this page does: locally, from these five numbers, depending on nothing staying online. It is also checkable, against NOAA's own published tables. NOAA's Solar Calculator ↗