Daylight Calculator

Calculate how many hours of daylight a location gets on any date, plus approximate sunrise, sunset, and the sun's declination, using the standard sunrise equation.

Quick Facts

Method
Sunrise equation from latitude and solar declination
Day length = 2 x sunset hour angle / 15; declination swings about ±23.45° across the year.

Results

Calculated
Daylight length
—
Hours of daylight on this date
Sunrise
—
Approx. local solar time
Sunset
—
Approx. local solar time
Solar declination
—
Sun's angle from the equator

How this daylight calculator works

Enter a latitude and a date, then click Calculate. The tool applies the sunrise equation used in solar geometry to estimate how many hours of daylight that location gets on that date, along with approximate sunrise and sunset times and the sun's declination. Click Clear to reset the fields to their defaults.

The formula

Solar declination (the angle of the sun above or below the equatorial plane) is estimated for day-of-year N with Cooper's approximation: δ = 23.45° × sin(360°/365 × (284 + N)). The sunset hour angle h is then found from cos(h) = -tan(latitude) × tan(δ). Day length in hours equals 2h / 15, since the sun moves 15 degrees of hour angle per hour. Sunrise and sunset are reported as apparent solar time, taken as solar noon (12:00) minus and plus half the day length.

Understanding the inputs

Latitude should be a decimal degree value from -90 to 90 — positive for the Northern Hemisphere (for example, about 40.7 for New York) and negative for the Southern Hemisphere (about -33.9 for Sydney). Date is any calendar date; the calculator converts it to a day-of-year number internally.

Interpreting the results

Daylight length is the total time the sun is above the horizon that day. Sunrise and Sunset are approximate solar clock times, not adjusted for your time zone, longitude offset, elevation, or atmospheric refraction, so they can differ from a local almanac by up to tens of minutes. Solar declination shows how far the sun's rays sit from the equatorial plane on that date — near 0° at the equinoxes and near ±23.45° at the solstices. At latitudes beyond about 66.5°, day length can reach 0 (polar night) or 24 (midnight sun) hours.

Frequently Asked Questions

How is daylight length calculated?
This calculator uses the sunrise equation from spherical astronomy. It estimates the sun's declination for the chosen date with Cooper's approximation, then finds the sunset hour angle from cos(h) = -tan(latitude) x tan(declination). Day length equals twice that hour angle converted to hours at 15 degrees per hour.
What is solar declination?
Solar declination is the angle between the sun's rays and Earth's equatorial plane. It swings between about +23.45 degrees near the June solstice and -23.45 degrees near the December solstice because Earth's axis is tilted roughly 23.45 degrees relative to its orbit. Declination near zero, around the equinoxes, gives close to 12 hours of daylight everywhere.
How accurate are the sunrise and sunset times?
The sunrise and sunset times are apparent solar time based on the geometric sun position only. They do not include atmospheric refraction, which lengthens the apparent day by a few minutes, the equation of time, your exact longitude within a time zone, or elevation, so real clock times from a local almanac can differ by up to tens of minutes.
Why do some latitudes get 24 hours of daylight or none at all?
Inside the polar circles, beyond roughly 66.5 degrees north or south latitude, Earth's axial tilt can push the sun's rays above or below the horizon for a full day. When -tan(latitude) x tan(declination) is less than -1 the sun never sets, called the midnight sun. When it is greater than 1 the sun never rises, called polar night.