The subscripts r, s and n denote sunrise, sunset and solar noon. Sunrise and sunset are recomputed once at the first estimate, then shifted by London, UTC+00:00.
About the sunrise and sunset calculator
The calculator follows NOAA's Solar Calculator, which uses Jean Meeus's formulas for the sun's declination and the equation of time on the chosen date. It then solves for the hour angle at which the centre of the sun is 90.833° from the zenith: the extra 0.833° allows 34′ for atmospheric refraction and 16′ for the sun's radius, so sunrise is the moment the top of the disc meets a flat horizon. Civil dawn and dusk use 96°, the sun's centre 6° below the horizon.
Photographers, walkers, sailors and anyone planning around daylight use it. In London on the June solstice 2026 the sun rises at 04:43 and sets at 21:22 BST, 16 h 38 min of daylight; on the December solstice the day lasts 7 h 50 min.
Times assume sea level and a clear, flat horizon. For the London, Singapore and Delhi examples below they match the US Naval Observatory's figures to the minute.
How sunrise and sunset times are calculated
Sunrise and sunset are the moments the top of the Sun's disk meets a flat, sea-level horizon, modeled as the Sun's center 0.833° below it. For Delhi on 15 January 2026 that puts sunrise at 07:15 and sunset at 17:46 IST, 10 h 31 min of daylight.
The 0.833° allows 34′ for atmospheric refraction, which lifts the Sun's image near the horizon, and 16′ for the Sun's radius. Civil dawn and dusk use the Sun's center 6° below the horizon, a zenith angle of 96°, with no refraction allowance.
The formula behind sunrise
The Earth turns 15° an hour, or 1° every 4 minutes. Sunrise comes H degrees of turning before solar noon and sunset H degrees after, where φ is the latitude and δ the Sun's declination:
cos H = cos 90.833° ÷ (cos φ × cos δ) − tan φ × tan δ
Solar noon, in minutes after midnight UTC, is 720 − 4λ − E, where λ is the longitude (east positive) and E the equation of time. Sunrise is solar noon minus 4H minutes and sunset solar noon plus 4H.
If cos H comes out above 1, the Sun does not rise that day (polar night); below −1, it does not set (midnight sun).
Sunrise worked by hand: Delhi, 15 January 2026
NOAA's formulas, after Jean Meeus, give the Sun's declination δ = −21.11° and the equation of time E = −9.33 minutes for that date.
With φ = 28.6139°: cos H = cos 90.833° ÷ (cos 28.6139° × cos −21.11°) − tan 28.6139° × tan −21.11° = 0.1928, so H = 78.88°, or 315.5 minutes of clock time.
Solar noon is 720 − 4 × 77.209 − (−9.33) = 420.5 minutes after midnight UTC, about 12:30:30 IST.
Sunrise is 420.5 − 315.5 = 105.0 minutes, 01:45 UTC or 07:15 IST. Sunset is 420.5 + 315.5 = 736.0 minutes, 12:16 UTC or 17:46 IST.
NOAA's procedure then repeats step 2 with the Sun's position at the estimated time, which moves these results by seconds. Day length is the time between the unrounded sunrise and sunset.
In the Tromsø rows cos H falls outside −1 to 1, so there is no sunrise or sunset. The Sun stays up all day in June, and in December it stays below the horizon but comes close enough for civil twilight.
Why the earliest sunrise is not on the longest day
Sunrise and sunset sit almost symmetrically around solar noon, and solar noon drifts with the equation of time. In London in December 2026 it moves from 11:50 to 12:03 GMT, about half a minute a day near the solstice.
Day length then changes by only seconds a day, so the whole day slides later. London's earliest sunset, 15:51, comes on 12 and 13 December, the shortest day is 21 December, and the latest sunrise, 08:06, waits until 30 and 31 December.
June mirrors this: the earliest sunrise falls on 17 June and the latest sunset on 25 June, either side of the 21 June solstice.
Mistakes that shift the times
Flipping the longitude sign. West is negative. New York entered as 74.006° instead of −74.006° moves the point to Central Asia, and on a New York clock its sunrise lands at 19:33 the evening before.
Flipping the latitude sign. South is negative. At −40.7128° the same June date gives a winter day of 9 h 15 min instead of New York's 15 h 5 min.
Keeping a fixed UTC offset through daylight saving. London at UTC+0 on 21 June 2026 shows 03:43 and 20:22, an hour early, because British Summer Time is UTC+1.
Expecting the sunrise you see over hills or buildings. High ground to the east delays the visible sunrise, while a high viewpoint sees the Sun earlier than the sea-level time.
How accurate the times are
NOAA's calculation details rate the sunrise and sunset results to within a minute between 72° N and 72° S, and within 10 minutes beyond. Observed times can differ further, because refraction changes with temperature and pressure.
Errors grow toward the poles because the Sun crosses the horizon at a shallow angle there, and the times change fast. In Tromsø, sunrise moves from 09:45 on 18 November 2026 to 11:20 on 27 November, and from 28 November the Sun does not rise at all.
Coordinates and time zones
Decimal degrees with north and east positive: London is 51.5074, −0.1278. Convert degrees, minutes and seconds with the angle/DMS converter first.
A named time zone applies that zone's offset at solar noon on the date, daylight saving included. A UTC offset stays fixed and accepts fractions, such as 5.5 for UTC+5:30.
Times are rounded to the nearest minute; day length comes from the unrounded times.
The exact poles, ±90°, have no defined hour angle, so use 89.99° instead.
Checked against: NOAA Solar Calculator main.js run in Node: rise 04:43:05, set 21:21:35, day 998.49 min; civil twilight from the same code at 96°; USNO API: rise 04:43, set 21:22, transit 13:02, civil twilight 03:55–22:09
Singapore at the March equinox, fixed offset
Latitude
1.3521 ° N
Longitude
103.8198 ° E
Date
2026-03-20
Show times in
UTC offset
UTC offset
8 hours
Sunrise
07:09
Sunset
19:15
Solar noon
13:12
Civil dawn (sun 6° below horizon)
06:48
Civil dusk
19:36
Checked against: NOAA Solar Calculator main.js: rise 07:09:00, set 19:15:29; USNO API: rise 07:09, set 19:15, transit 13:12, civil twilight 06:48–19:36
Midnight sun in Tromsø
Latitude
69.6492 ° N
Longitude
18.9553 ° E
Date
2026-06-21
Show times in
Time zone
Time zone
Oslo
Daylight
Midnight sun
Day length
1 d
Sunrise – sunset
Sun up all day
Checked against: NOAA main.js finds no sunrise or sunset on this date; USNO API: “Object continuously above the horizon”
Polar night in Tromsø, with civil twilight
Latitude
69.6492 ° N
Longitude
18.9553 ° E
Date
2026-12-21
Show times in
Time zone
Time zone
Oslo
Daylight
Polar night
Day length
0 s
Civil dawn (sun 6° below horizon)
09:31
Civil dusk
13:53
Checked against: USNO API: “Object continuously below the horizon”, civil twilight 09:31–13:53 (UTC+1); NOAA main.js at 96° gives 09:31:13 and 13:53:13
Questions
Why is the day longer than 12 hours at the equinox?
Because sunrise and sunset are timed at the top edge of the sun, and refraction lifts the sun's image by about 34′ near the horizon. Together they add several minutes of daylight at both ends. On 20 March 2026 the day lasts 12 h 6 min in Singapore and 12 h 10 min in London. In London, day and night are closest to equal on 17 March, three days before the equinox.
What is the difference between civil, nautical and astronomical twilight?
They are defined by how far the sun's centre is below the horizon: civil twilight ends at 6°, nautical at 12° and astronomical at 18°. In London on 21 June 2026 civil dusk comes at 22:09, 47 minutes after sunset. Around midsummer the sun gets no lower than about 15° below London's horizon, so astronomical twilight lasts all night.
What is solar noon, and why isn't it at 12:00?
Solar noon is the moment the sun crosses the meridian and stands highest in the sky. Clock time differs from it for three reasons: your longitude within the time zone, daylight saving time, and the equation of time, which varies from about −14 minutes in February to about +16 minutes in early November. In London in June solar noon is at about 13:02 BST.
Where do the midnight sun and polar night happen?
North of the Arctic Circle, at about 66.6° N, and south of the Antarctic Circle. In Tromsø, at 69.6° N, the sun stays above the horizon for weeks around the June solstice and does not rise from late November to mid-January. Even on 21 December, civil twilight there lasts from 09:31 to 13:53, so the polar night is not completely dark.
This calculator includes 5 worked examples with independently sourced answers. They run in the test suite, and you can run them here too.
Put this calculator on your site
Paste this where you want the calculator to appear. It is free to use, it stays in step with corrections made here, and the credit line below it links back so your readers can find the full version.