Daylight Length Calculator: Hours of Daylight from Sunrise and Sunset or from Latitude and Date
Find the length of the day and night from sunrise and sunset times, or from any latitude and date with the NOAA solar equations: daylight hours, civil twilight, change since yesterday, longest and shortest day, and a month-by-month table and chart.
How it works
From times: daylight = sunset − sunrise; night = 24 h − daylight · From place and date: cos H = (sin(−0.833°) − sin φ × sin δ) ÷ (cos φ × cos δ); daylight (hours) = 2H ÷ 15°, where φ = latitude and δ = the Sun’s declination for the date (NOAA / Meeus equations); civil twilight uses −6° instead of −0.833°
If you already know today’s sunrise and sunset, daylight length is simply the gap between them, and the night is the rest of the 24 hours. The calculator also gives the decimal hours, how far the day is from an even 12 hours, and the midpoint of the day, which is close to local solar noon. With “City and date” or “Latitude and date” it works out the day length itself. The Sun’s declination for the date comes from the same equations as NOAA’s solar calculator (based on Jean Meeus, Astronomical Algorithms). The sunrise hour angle H is where the Sun’s centre is 0.833° below the horizon, which accounts for atmospheric refraction and the Sun’s radius, so “sunrise” is the moment its top edge appears. The day is 2H, turned into hours at 15° per hour. With civil twilight (Sun 6° below the horizon) added, you get the usable light from dawn to dusk. Day length depends on latitude, not longitude: everywhere has about 12 hours at the equinoxes, the equator stays near 12 hours all year, and beyond the polar circles there is midnight sun in summer and polar night in winter. Results agree with the US Naval Observatory tables to within about a minute away from the poles; local hills, buildings and altitude shift real sunrise and sunset slightly.
Worked example
Sunrise at 06:30 and sunset at 19:45 give 19:45 − 06:30 = 13 h 15 min of daylight and 24 h − 13 h 15 min = 10 h 45 min of night. Daylight is 795 ÷ 1,440 = 55.2% of the day, 13.25 decimal hours, 1 h 15 min more than 12 hours, and the midpoint of the day is 13:08. For a place and date: Madrid (40.4° N) on June 21, 2026 has 15.06 hours, shown as 15 h 4 min, of daylight (the US Naval Observatory lists sunrise 06:45 and sunset 21:48, 15 h 3 min between the rounded minutes), and New York (40.7° N) on December 21, 2026 has 9 h 15 min.
Sources: NOAA Global Monitoring Laboratory: Solar calculation details (Meeus equations, 0.833° refraction) · US Naval Observatory: Sun rise/set and twilight data, Madrid, June 21, 2026 · US Naval Observatory: Sun rise/set and twilight data, New York, December 21, 2026
Frequently asked questions
How is the length of the day calculated?
It is the time from sunrise to sunset. From a latitude and date, the Sun’s declination gives the hour angle H at which the Sun sets: cos H = (sin(−0.833°) − sin latitude × sin declination) ÷ (cos latitude × cos declination). The day lasts 2H ÷ 15 hours.
Does twilight count as daylight?
Not in the main result, which runs from sunrise to sunset. Civil twilight, while the Sun is less than 6° below the horizon, gives enough light for most outdoor activities and adds roughly 25 to 45 minutes at each end in mid-latitudes. The “daylight plus civil twilight” line includes it.
What is the longest day of the year?
In the Northern Hemisphere it is the June solstice, around June 20–21; in the Southern Hemisphere it is the December solstice, around December 21–22. At 40° N that day lasts about 15 hours, and at 50° N about 16 hours 20 minutes.
Why is the day about 12 hours on the equinox?
At the March and September equinoxes the Sun is over the equator (declination near 0°), so it spends half of its daily circle above the horizon everywhere. Refraction and the Sun’s size make the day a few minutes longer than 12 hours.
Why does day length change faster in March and September?
The Sun’s declination changes fastest near the equinoxes and barely moves near the solstices. At 40° latitude the day grows or shrinks by about 2 to 3 minutes a day around the equinoxes, but by only seconds a day near the solstices.
Does longitude or time zone matter?
Not for the length of the day, only for the clock times of sunrise and sunset. Places on the same latitude have the same day length on the same date.
Related calculators
This calculator is for educational purposes. Double-check important results before acting on them.