How sunrise times are calculated: our method, sources and validation
Every time on this site — from the calculator to the city tables — comes from one small JavaScript module we wrote ourselves, implementing formulas published by the NOAA Global Monitoring Laboratory solar calculator. This page discloses exactly what we compute, from what sources, and how closely the results match official national almanacs. We think a light-planning site should show its work.
Key takeaways
- We implement NOAA’s public-domain solar-position series (equations
from Meeus’ Astronomical Algorithms as published by NOAA) in
assets/js/solar.js— no black boxes, no server calls. - NOAA states these formulas are accurate to about one minute for latitudes between ±72°; observed times vary with atmospheric conditions.
- We validated against two official sources: the Hong Kong Observatory Almanac 2026 and Taiwan’s CWA 2026 Taipei table. Across 43 published events: 36 matched to the minute, worst deviation 3 minutes.
- DST rules for US/EU/AU cities are hardcoded IANA-style rules, verified for 2026–2027; HK, Taipei, Tokyo and Singapore never observe DST.
The recipe, step by step
Sunrise time is not read from a database — it is solved from geometry. Here is the pipeline our engine runs for a requested date and place:
- Date to Julian day. The calendar date becomes a Julian day number, the continuous day count astronomers use.
- Solar coordinates. From the number of Julian centuries since J2000.0, NOAA’s series give the sun’s geometric mean longitude, mean anomaly, equation of center, true and apparent longitude, and the obliquity of the ecliptic — all standard polynomial expansions.
- Declination and equation of time. Those give the sun’s declination (how far north or south of the equator it appears) and the equation of time (the offset between sundial time and clock time, up to ±16 minutes across the year).
- Solar noon. Local solar noon in UTC = 720 − 4×longitude − equation of time, refined in a second pass. Add the time-zone offset (checking DST rules at that instant) for clock time.
- The sunrise equation. With latitude φ and declination δ, solve cos H = (cos 90.833° − sin φ sin δ) / (cos φ cos δ) for the hour angle H. Sunrise = solar noon − 4H minutes; sunset = noon + 4H. The 90.833° zenith target folds in the sun’s 16′ radius and 34′ of standard atmospheric refraction — the same convention official almanacs use, so "sunrise" means the moment the sun’s upper edge appears on a sea-level horizon.
- Two-pass refinement. Exactly as NOAA’s reference implementation, we recompute declination and equation of time at the estimated event time and solve again.
- Bands for twilight and magic hours. The same equation with different target elevations: −6° civil, −12° nautical, −18° astronomical twilight; −4°…+6° golden hour; −6°…−4° blue hour (definitions vary).
Sources
- NOAA GML — Solar Calculator and its calculation details (equations from Meeus; US Government work, public domain).
- Hong Kong Observatory — Almanac 2026 monthly calendars (daily sunrise / sun transit / sunset for Hong Kong).
- Taiwan Central Weather Administration — 2026 Taipei sunrise/sunset table (full-year, PDF).
- NOAA notes it “cannot certify or authenticate sunrise, sunset or solar position data” and that observed values vary with the atmosphere — a caveat we adopt as our own.
Validation: every spot-check, disclosed
On 2026-11-16 we compared our engine’s output against every cleanly-readable published value above, covering solstices, equinoxes and arbitrary dates spread across the year. “—” marks cells the official PDF render made unverifiable at digit level (we dropped those rather than guess; the pattern across adjacent dates is consistent). Δ is engine minus official, in minutes:
| Source | Date 2026 | Sunrise | Sunset | Solar noon | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Official | Ours | Δ | Official | Ours | Δ | Official | Ours | Δ | ||
| HKO | 2026-03-20 | 06:28 | 06:28 | +0m | 18:36 | 18:34 | −2m | 12:32 | 12:31 | −1m |
| HKO | 2026-06-21 | 05:40 | 05:40 | +0m | 19:10 | 19:10 | +0m | 12:26 | 12:25 | −1m |
| HKO | 2026-09-23 | 06:13 | 06:12 | −1m | 18:19 | 18:19 | +0m | 12:16 | 12:16 | +0m |
| HKO | 2026-12-21 | 06:58 | 06:58 | +0m | 17:44 | 17:44 | +0m | — | 12:21 | — |
| HKO | 2026-03-01 | 06:45 | 06:45 | +0m | 18:24 | 18:27 | +3m | 12:35 | 12:36 | +1m |
| HKO | 2026-03-31 | 06:17 | 06:17 | +0m | 18:38 | 18:38 | +0m | 12:28 | 12:28 | +0m |
| HKO | 2026-09-30 | 06:14 | 06:14 | +0m | 18:12 | 18:12 | +0m | 12:13 | 12:14 | +1m |
| HKO | 2026-12-01 | 06:46 | 06:46 | +0m | 17:38 | 17:38 | +0m | 12:12 | 12:12 | +0m |
| HKO | 2026-12-31 | 07:02 | 07:02 | +0m | — | 17:50 | — | 12:26 | 12:26 | +0m |
| CWA | 2026-03-20 | 05:58 | 05:58 | +0m | 18:05 | 18:05 | +0m | — | 12:02 | — |
| CWA | 2026-06-21 | 05:05 | 05:05 | +0m | 18:47 | 18:47 | +0m | — | 11:56 | — |
| CWA | 2026-09-23 | 05:43 | 05:43 | +0m | 17:50 | 17:50 | +0m | — | 11:47 | — |
| CWA | 2026-12-21 | 06:34 | 06:34 | +0m | 17:09 | 17:09 | +0m | — | 11:52 | — |
| CWA | 2026-01-01 | 06:39 | 06:39 | +0m | 17:16 | 17:16 | +0m | — | 11:57 | — |
| CWA | 2026-07-04 | 05:09 | 05:09 | +0m | 18:48 | 18:48 | +0m | — | 11:58 | — |
| CWA | 2026-10-10 | 05:50 | 05:50 | +0m | 17:32 | 17:32 | +0m | — | 11:41 | — |
| CWA | 2026-12-10 | 06:28 | 06:28 | +0m | 17:05 | 17:05 | +0m | — | 11:46 | — |
These checks run automatically: node tests.mjs executes all of them (plus
equation-of-time anchors, solstice declinations, DST boundary tests and a DOM-shim test of
the calculator) and fails the build if any deviation exceeds ±3 minutes.
Known limitations — the honest part
- Atmosphere. Refraction near the horizon varies with temperature and pressure; NOAA warns observed sunrises can differ visibly from calculations. Standard conditions are assumed everywhere here.
- Horizon. We assume sea level and zero obstruction. Hills and buildings can shift your visible sunrise by many minutes — the deepest source of real-world difference.
- DST horizon. Rules are hardcoded and verified for 2026–2027; later years use the recurring legislative pattern, which could change (the EU has debated scrapping DST entirely).
- Not an official source. If minutes are contractual (broadcast windows, prayer times, aviation), use your national ephemeris. We are a planning aid for photographers, not an authority.
Related reading
- The sun calculator — see the engine in action
- Hong Kong tables and Taipei tables — the two validated cities
- Sun-position apps vs tables — where this site fits in your kit