Sunrise and Sunset Calculator
Calculate sunrise, sunset, solar noon and the three twilights for any date and location, using the NOAA solar position algorithm.
How to use this calculator
- 1Enter the date and your latitude and longitude — positive north and east, negative south and west.
- 2Set the UTC offset for that date, including daylight saving if it applies.
- 3Read sunrise, sunset and solar noon, with the three twilight phases below.
How the calculation works
cos(H) = (cos(zenith) − sin(lat)·sin(δ)) ÷ (cos(lat)·cos(δ)) sunrise = solar noon − 4H solar noon = 720 − 4·longitude − EoT- δ
- Solar declination — how far north or south of the equator the Sun is, between ±23.44°
- H
- Hour angle in degrees. The Earth turns 15° an hour, so 4 minutes per degree
- zenith
- 90.833° for sunrise and sunset; 96°, 102° and 108° for civil, nautical and astronomical twilight
- EoT
- Equation of time — the difference between apparent and mean solar time, swinging about ±16 minutes over the year
The 0.833° added to 90° is not a fudge factor. It is the Sun's apparent radius of 0.267° plus about 0.567° of atmospheric refraction at the horizon, and omitting it puts sunrise several minutes late.
When cos(H) falls outside ±1 there is no solution, which is the algorithm telling you the Sun never reaches that altitude — polar day or polar night depending on the sign.
The equation of time exists because Earth's orbit is elliptical and its axis is tilted. Apparent solar time runs up to 16 minutes ahead of clock time in early November and 14 minutes behind in mid-February.
This is the NOAA algorithm, accurate to about a minute for latitudes below 72°. Nearer the poles the Sun crosses the horizon at such a shallow angle that small errors in refraction translate into large errors in time.
Worked example
London on the summer solstice
- 1.On 21 June the Sun's declination is near its maximum of +23.44°.
- 2.At latitude 51.51° the Sun reaches 90 − |51.51 − 23.44| = 61.9° above the horizon at noon.
- 3.The hour angle works out near 120°, and at 4 minutes per degree that is about 8 hours either side of solar noon.
- 4.Sunrise falls around 04:43 and sunset around 21:21 British Summer Time.
- 5.Daylight lasts about 16 hours 38 minutes — the longest of the year.
Result: Sunrise 04:43, sunset 21:21
Tromsø in midwinter — polar night
- 1.Tromsø sits at 69.65° north, well inside the Arctic Circle at 66.56°.
- 2.On the winter solstice the Sun's declination is −23.44°.
- 3.Maximum altitude: 90 − |69.65 − (−23.44)| = 90 − 93.09 = −3.09°, below the horizon.
- 4.The hour angle equation has no solution, because cos(H) falls outside ±1.
- 5.The Sun does not rise at all — this is polar night, though civil twilight still brings a few hours of dim light around midday.
Result: Sun never rises
Why sunrise is not when the Sun crosses the horizon
Sunrise is defined as the moment the Sun's upper edge appears, not its centre, and the Sun's disc is about half a degree wide. That alone shifts the moment by roughly a minute at mid-latitudes.
Atmospheric refraction matters more. Air bends light passing through it, and the effect is strongest near the horizon where the light travels the longest path through dense air — lifting the Sun's apparent position by about 0.567°. The consequence is genuinely strange: at the moment you see the Sun touch the horizon at sunset, it is already geometrically below it. You are seeing an image bent over the curve of the Earth.
Together these give the standard zenith of 90.833° rather than 90°. Refraction also varies with temperature and pressure, which is why published times carry an uncertainty of a minute or so and why unusual atmospheric conditions occasionally produce sunrises several minutes early.
The three twilights, and why sailors got one
Twilight is graded by how far the Sun has sunk below the horizon, and each threshold marks a practical loss of capability rather than an arbitrary angle.
Civil twilight ends at 6° below, the point at which there is no longer enough natural light to read or carry out outdoor activity without artificial lighting. Most legal definitions of "lighting-up time" hang on it.
Nautical twilight ends at 12°. Its meaning is precise: below this angle the sea horizon is no longer distinguishable, which matters because celestial navigation requires sighting stars *against* the horizon. Between 6° and 12° a navigator has both bright stars and a visible horizon — the narrow window when a sextant works.
Astronomical twilight ends at 18°, when scattered sunlight no longer interferes with observation and the sky is as dark as it will get. Above about 48° latitude this never happens around midsummer, which is why northern European observatories lose their deep-sky season entirely.
Solar noon is rarely at noon
The Sun is highest at solar noon, and that almost never coincides with 12:00 on the clock. Two separate effects pull it around.
The first is longitude. Time zones are typically an hour wide, spanning 15° of longitude, but clocks read the same throughout. Someone at the western edge of a zone sees solar noon nearly an hour later than someone at the eastern edge, and zone boundaries drawn around political borders make the discrepancy larger still — parts of western China run more than three hours off solar time.
The second is the equation of time, which is astronomical rather than administrative. Earth's orbit is elliptical, so it moves faster near perihelion in January, and its axis is tilted, so the Sun's apparent motion is not uniform along the celestial equator. The combined effect swings apparent solar time up to 16 minutes ahead of mean time in early November and 14 minutes behind in mid-February.
This is why the earliest sunset of the year does not fall on the winter solstice — it comes about two weeks earlier in the northern hemisphere, and the latest sunrise about two weeks after. The solstice has the shortest day, but the equation of time shifts where that day sits.
What this assumes, and where it stops
Assumptions
- A flat, unobstructed horizon at sea level.
- Standard atmospheric refraction of about 0.567° at the horizon, included in the 90.833° zenith.
- The NOAA solar position algorithm, accurate to roughly one minute below 72° latitude.
- The UTC offset entered applies on the date given, including any daylight saving.
Limitations
- Accuracy degrades above about 72° latitude, where the Sun crosses the horizon at a very shallow angle and small refraction errors become large time errors.
- Assumes sea level and a flat horizon. Elevation brings sunrise earlier and sunset later; mountains or buildings do the reverse.
- Refraction varies with temperature and pressure, so real times can differ by a minute or more from any calculated figure.
- The UTC offset must be entered by hand — there is no time zone database, so daylight saving is your responsibility.
- Does not compute moonrise, moonset, or the position of the Sun at times other than these events.
Common questions
Why is sunrise calculated at 90.833° rather than 90°?
Because two effects shift it. The Sun's disc is about 0.533° wide and sunrise means its upper edge appearing, not its centre, contributing 0.267°. Atmospheric refraction lifts the apparent Sun by a further 0.567° at the horizon. Using a flat 90° would put every sunrise several minutes late.
What is the difference between civil, nautical and astronomical twilight?
They are graded by the Sun's depth below the horizon: 6°, 12° and 18°. Civil twilight ends when there is no longer enough light for outdoor activity. Nautical twilight ends when the sea horizon becomes indistinguishable, which matters for celestial navigation. Astronomical twilight ends when the sky is fully dark for observing.
Why is solar noon not at 12:00?
Two reasons. Your longitude within the time zone shifts it — zones span 15° but everyone reads the same clock. And the equation of time, caused by Earth's elliptical orbit and axial tilt, swings apparent solar time up to 16 minutes ahead in November and 14 behind in February.
Why is the earliest sunset not on the shortest day?
Because of the equation of time. The winter solstice has the least daylight, but the whole solar day is shifting relative to the clock at that time of year. In the northern hemisphere the earliest sunset falls around two weeks before the solstice and the latest sunrise around two weeks after it.
Sources
Formula and content last reviewed on .
Results are estimates for information only, not professional advice.
Related calculators
Tools people commonly use alongside the sunrise and sunset calculator.