Sunrise & Sunset Calculator
Last updated: 27 August 2026
Reviewed by Gavin Meiring, Lead research and primary author ยท Doctoral Candidate (Corporate Governance) ยท Research and drafting assisted by AI
- Sunrise and sunset times are computed from the observer's latitude and longitude plus the 'equation of time' โ the mismatch between solar time and clock time caused by Earth's elliptical orbit and axial tilt, which shifts the sun's position by up to about 16 minutes across the year.
- The earliest sunrise and latest sunset do not fall on the summer solstice: at mid-northern latitudes the earliest sunrise comes about a week before the solstice and the latest sunset about a week after it.
- At the equator, day length stays close to 12 hours all year, with sunrise and sunset shifting by only minutes โ while inside the Arctic and Antarctic circles the sun can stay above or below the horizon for months at a time.
Sunrise Sunset Calculator
A sunrise sunset calculator provides accurate times for sunrise, sunset, solar noon, dawn, dusk, and the length of daylight for any location and date. It is used by photographers, farmers, hikers, pilots, sailors, and anyone planning outdoor activities who needs to know the exact hours of available daylight.
How to Use the Sunrise Sunset Calculator
- Enter your location by city name, postcode, or latitude and longitude coordinates.
- Select the date, or leave it as today.
- Click "Calculate" to see sunrise, solar noon, and sunset times in your local time zone.
- View civil, nautical, and astronomical twilight times for photography and navigation planning.
- See the total daylight hours and how they compare to the previous day and the seasonal extremes.
The Formula
Sunrise and sunset times are calculated using spherical astronomy equations. The key inputs are:
- Latitude (phi): your geographic latitude in degrees.
- Longitude (lambda): your geographic longitude in degrees.
- Julian date (JD): the continuous day count from 1 January 4713 BC.
- Solar declination (delta): the angle between the Sun's rays and the equatorial plane.
The core calculation:
Calculate the Sun's declination for the date: delta = -23.45 x cos(360/365 x (d + 10)) degrees Where d = day of year (1-365).
Calculate the hour angle (H) at which the Sun's elevation equals the horizon (0 degrees): cos(H) = -tan(phi) x tan(delta) H = arccos(-tan(phi) x tan(delta))
Convert hour angle to time: Sunrise time = Solar noon - H/15 hours Sunset time = Solar noon + H/15 hours
Solar noon is when the Sun crosses the meridian, adjusted for longitude and the equation of time (a correction for the eccentricity of Earth's orbit and axial tilt).
Twilight definitions:
- Civil twilight: Sun is 0 to 6 degrees below horizon (enough light for most outdoor activities).
- Nautical twilight: Sun is 6 to 12 degrees below horizon (horizon visible at sea).
- Astronomical twilight: Sun is 12 to 18 degrees below horizon (sky dark enough for most astronomy).
Real-World Example
Calculate sunrise and sunset for London (51.5ยฐN, 0.1ยฐW) on the summer solstice, 21 June 2026.
Day of year: d = 172.
Solar declination: delta = -23.45 x cos(360/365 x (172 + 10)) = -23.45 x cos(179.6ยฐ) = approximately +23.4ยฐ (maximum summer value)
Hour angle: cos(H) = -tan(51.5ยฐ) x tan(23.4ยฐ) = -1.249 x 0.433 = -0.541 H = arccos(-0.541) = 122.7ยฐ
Time offset from solar noon: 122.7 / 15 = 8.18 hours = 8 hours 11 minutes
Solar noon in London on 21 June: approximately 13:01 BST (British Summer Time, UTC+1).
Sunrise: 13:01 - 8:11 = 04:50 BST Sunset: 13:01 + 8:11 = 21:12 BST
Daylight hours: approximately 16 hours 22 minutes. This is one of the longest days in the UK.
Seasonal Variation in Daylight Hours
The length of the day changes dramatically with latitude and season. In London, the shortest day (winter solstice, around 21 December) brings only about 7 hours 50 minutes of daylight, while the longest day delivers over 16 hours. In Edinburgh (55.9ยฐN), the contrast is even more pronounced: approximately 6 hours 58 minutes in December versus 17 hours 36 minutes in June. At the Arctic Circle (66.5ยฐN), the Sun does not set at all around the summer solstice (midnight sun) and does not rise at all around the winter solstice (polar night). Planning outdoor work, photography, or travel around daylight hours is especially important at high latitudes.
Frequently Asked Questions
What is the difference between sunrise and civil dawn? Civil dawn occurs when the Sun is 6 degrees below the horizon, before it rises above the horizon. There is enough ambient light during civil twilight to see clearly outdoors without artificial lighting. Sunrise is the moment the top edge of the Sun first appears above the horizon. Photographers often prefer the "golden hour" just after civil dawn or just before civil dusk, when the light is warm and directional but the Sun has not yet risen fully.
Why do sunrise and sunset times vary even at the same latitude? Longitude affects the local solar time. Locations further east within the same time zone experience earlier sunrises and sunsets. The equation of time, which reflects the non-circular orbit of the Earth and its axial tilt, also causes the solar day to vary from exactly 24 hours throughout the year. This is why the earliest sunrise is not exactly on the summer solstice, but a few days before it.
What is solar noon? Solar noon is the moment when the Sun reaches its highest point in the sky for that day and crosses the local meridian. It is not necessarily at 12:00 on your clock, as clocks are set to fixed time zones that may be offset from your exact longitude. Solar noon in London can occur anywhere from 12:57 to 13:06 depending on the time of year, due to the equation of time.
How does this affect sunrise times at the same latitude but different longitudes? For every degree of longitude further east, sunrise arrives approximately 4 minutes earlier in local solar time. However, clock time is set by time zones, so within a single time zone, eastern locations see the Sun rise and set earlier on the clock while western locations experience later times. Spain, for example, uses Central European Time but sits at similar longitudes to the UK, resulting in very late sunsets by clock time.
Daylight hours at five latitudes
The formula on this page produces a day length for any latitude and date, as long as the arccos term stays inside its range. Running it for the two solstices gives a table you can reproduce with a calculator.
| Location | Latitude | 21 June | 21 December |
|---|---|---|---|
| London | 51.5 north | 16h 24m | 7h 36m |
| Edinburgh | 55.9 north | 17h 19m | 6h 41m |
| New York | 40.7 north | 14h 55m | 9h 05m |
| Cape Town | 33.9 south | 9h 44m | 14h 16m |
| Reykjavik | 64.15 north | 20h 28m | 3h 32m |
Cape Town shows the southern hemisphere running the other way. Its June day is the short one. Reykjavik sits close enough to the Arctic Circle that its June day runs past 20 hours while its December day barely clears three and a half.
Where the seasons come from in the arithmetic
The declination drives everything. On day 172 of the year, 21 June, the page's cosine approximation gives a declination of 23.4491 degrees, which is close to the true 23.44 degrees of the solstice. On day 355, 21 December, it gives minus 23.45 degrees. The hour angle H then comes from arccos of minus tan(phi) tan(delta), and the day length is twice H divided by 15 degrees per hour.
The London entry is worth working in full, because it exposes a difference between two parts of this page.
The formula as written gives tan(51.5) as 1.257172 and tan(23.4491) as 0.433757. Their product is 0.545307, so the arccos argument is minus 0.545307. The hour angle is 123.0457 degrees, which is 8 hours 12 minutes each side of solar noon, and the day runs to 16 hours 24 minutes. The worked example above prints 122.7 degrees and about 16 hours 22 minutes, which comes from taking tan(51.5) as 1.249 rather than 1.257172. The difference is two minutes of daylight and it does not change any planning decision, but the two numbers should agree and they do not.
The seasonal section lower down uses a different convention again. It reports about 7 hours 50 minutes for London in December and about 6 hours 58 minutes for Edinburgh. The plain geometric formula gives 7 hours 36 minutes and 6 hours 41 minutes for those same dates. Something else is moving the numbers by a quarter of an hour.
The 0.833 degree term that reconciles them
Sunrise is defined by the moment the upper edge of the Sun's disc touches the horizon, not the moment the centre crosses it. Add the effect of atmospheric refraction near the horizon and the Sun has to be geometrically below the horizon for it to appear above it. The standard correction folds both effects into one number: sunrise and sunset are computed for a solar zenith angle of 90.833 degrees rather than 90.
Applying that to the same five locations:
| Location | 21 June geometric | 21 June with refraction | 21 December geometric | 21 December with refraction |
|---|---|---|---|---|
| London | 16h 24m | 16h 38m | 7h 36m | 7h 49m |
| Edinburgh | 17h 19m | 17h 36m | 6h 41m | 6h 58m |
| New York | 14h 55m | 15h 06m | 9h 05m | 9h 15m |
| Cape Town | 9h 44m | 9h 54m | 14h 16m | 14h 25m |
| Reykjavik | 20h 28m | 21h 10m | 3h 32m | 4h 06m |
The corrected figures land on the seasonal numbers this page already prints for Edinburgh, at 6 hours 58 minutes in December and 17 hours 36 minutes in June. The gain from the correction grows with latitude: about 10 minutes in New York, 14 in London, 17 in Edinburgh and 41 in Reykjavik, where the Sun crosses the horizon at a shallow angle and a small shift in its altitude moves the clock a long way.
So the page holds two conventions. The worked example is geometric, and the seasonal comparison is refraction-corrected. Both are defensible, and neither is labelled. If you need a time you can compare against a published almanac, use the refraction-corrected form.
Where the formula stops working
The arccos term has to stay between minus one and plus one. It leaves that range when the magnitude of the latitude exceeds 90 degrees minus the magnitude of the declination. At the solstice declination of 23.4491 degrees, the threshold sits at 66.5509 degrees of latitude. That is the Arctic Circle, which is defined as 90 degrees minus the obliquity of the ecliptic and sits at about 66.56 degrees.
Below the threshold the formula returns a day length. Above it the term falls outside the range and there is no sunrise or sunset to report, because the Sun stays up or stays down for the full rotation. At 70 degrees north on 21 June the argument comes to minus 1.1917, so the correct answer is a 24 hour day rather than a computed number. Any implementation has to test for that case before calling arccos, or it will return an error on the days that matter most to a reader near the pole.
The NOAA convention and its accuracy limits
The 90.833 degree zenith angle and the accuracy limits used here come from the National Oceanic and Atmospheric Administration's solar calculator documentation, which states that the sunrise and sunset results are based on equations from Jean Meeus, "Astronomical Algorithms", and are theoretically accurate to within a minute for latitudes between 72 degrees north and 72 degrees south, and within 10 minutes outside that range. NOAA also notes that observed times vary with atmospheric pressure, temperature and humidity, so the two minute gap between the page's worked example and its own formula is well inside the noise of the physical problem.
Also try these free tools: