Sunset Calculator — Sunset Time by Location & Date
Enter a latitude, longitude, date and your UTC offset to calculate the precise local sunset time, solar noon, sunrise and total daylight duration — including polar day and polar night detection.
°
°
Month
h
Sunset at 09:58 local time
How does this calculator work?
Sunset time = Solar noon + hour angle/15°. The hour angle ω₀ = arccos[(sin(−0.833°) − sin φ · sin δ) / (cos φ · cos δ)], where φ is latitude and δ is solar declination. Declination varies ±23.44° with the seasons. Days are longest near the summer solstice; beyond the polar circles the Sun may not set at all.
Formula
How this is calculated
Sunset is the moment the upper limb of the Sun's disc touches the horizon as it descends in the west. The standard definition uses −0.833° below the geometric horizon, accounting for atmospheric refraction (~0.583°) that bends sunlight slightly upward and for the Sun's apparent radius (~0.25°). This makes the visible sun set about 2 minutes later than a simple geometric calculation would suggest.
The calculator uses the NOAA simplified solar algorithm: it calculates the Julian date offset from J2000.0, derives the Sun's ecliptic longitude from the mean anomaly and equation of the centre, converts to solar declination δ, and finally solves the horizon equation for the hour angle ω₀ — the angular distance (converted to time at 15° per hour) from solar noon to sunset. Adding ω₀/15 to solar noon gives the UTC sunset time, which is then converted to local time using your UTC offset.
Longer days occur in summer because the higher declination δ pushes the hour angle ω₀ wider. Near the Arctic and Antarctic circles (±66.56°) the Sun grazes the horizon at the solstices; beyond the polar circles the equation has no solution, producing polar day (midnight sun) or polar night.
Frequently asked questions
Sunset is when the Sun's disc disappears below the horizon. Civil twilight ends when the centre is 6° below; nautical twilight at 12°; astronomical twilight at 18°. This calculator gives the sunset moment only — civil twilight adds roughly 20–30 minutes of usable light after sunset.
Both cities use Central European Time (UTC+1 standard / UTC+2 summer), but Madrid is ~3.7° west of London. Solar time is earlier in the west: for every 1° west the sun rises and sets about 4 minutes later in solar time, but most of Spain uses Central European rather than Atlantic time for political reasons.
No — DST is not applied automatically because it changes by country and even by region. If your area observes DST, add 1 extra hour to the UTC offset field (e.g. use UTC+2 instead of UTC+1 during summer DST).
Also known as
TG we-Calculate Editorial Team. (2026). Sunset Calculator — Sunset Time by Location & Date [Online calculator]. TG we-Calculate. https://we-calculate.com/calculator/sunset-calculator
TG we-Calculate Editorial Team. "Sunset Calculator — Sunset Time by Location & Date." TG we-Calculate. 2026. https://we-calculate.com/calculator/sunset-calculator.
TG we-Calculate Editorial Team, "Sunset Calculator — Sunset Time by Location & Date," TG we-Calculate, 2026. [Online]. Available: https://we-calculate.com/calculator/sunset-calculator
@misc{wecalculate_sunset_calculator, title = {Sunset Calculator — Sunset Time by Location & Date}, author = {{TG we-Calculate Editorial Team}}, howpublished = {\url{https://we-calculate.com/calculator/sunset-calculator}}, year = {2026}, note = {TG we-Calculate} }
Did this calculator help you?
