GenerateRandomSearch

Daylight Hours Calculator

Day length depends on two things: how far north or south you are, and where the Earth is in its orbit. Those give the solar declination and the hour angle, and everything else follows. This computes the day length for any latitude and any day of the year, identifies midnight sun and polar night where they occur, and confirms that sunrise and sunset really are symmetric about solar noon.

What this generator does

Computes the solar declination for the day, derives the hour angle from it and the latitude, and turns that into sunrise, sunset and day length. Where the geometry allows no sunrise or no sunset it says so rather than returning a nonsensical time.

How to use this tool

  1. Enter your latitude — positive for north, negative for south.
  2. Enter the day of the year; 172 is around midsummer.
  3. Read the day length and the solar sunrise and sunset.
  4. Try a latitude above 66 to find midnight sun and polar night.

Understanding the controls

Latitude
Degrees north as positive, south as negative. The effect grows sharply towards the poles — the equator barely varies while 60 degrees swings by more than ten hours across the year.
Day of the year
1 is 1 January. Around 80 and 264 are the equinoxes, when everywhere gets close to twelve hours; 172 and 355 are the solstices.

Common use cases

  • Working out day length for a date and place
  • Explaining why summer days are so much longer further north
  • Planning an outdoor event around available light
  • Seeing where midnight sun and polar night actually begin
  • Comparing two latitudes on the same day of the year

How this generator works

The solar declination — how far north or south of the equator the sun is overhead — follows from the day of the year and the Earth's 23.44 degree tilt. Combined with the latitude it gives the hour angle: how far the sun travels from noon before setting. Day length is twice that, and sunrise and sunset sit either side of solar noon. When the geometry gives no solution the sun either never sets or never rises, which the tool reports directly. Before display the symmetry about noon is checked, the day length is confirmed to be both twice the hour angle and the gap between the two times, and the declination is confirmed to stay within the Earth's tilt.

Randomness and fairness

Nothing here is random. A latitude and a day give exactly one day length.

For how randomness is produced across the whole site, see how Generate Random works.

Limitations and good to know

  • Times are solar rather than clock times: the equation of time and your position within a timezone can shift them by up to a quarter of an hour or more.
  • Atmospheric refraction and the sun's disc are not accounted for, which makes real sunrise a couple of minutes earlier and sunset later.
  • Altitude is ignored, so a mountain sees the sun before a valley does.
  • The declination formula is the standard approximation, accurate to a few tenths of a degree rather than exactly.

Privacy and your data

The calculation runs in your browser and the latitude and date you enter are never transmitted, stored or included in analytics.